convert

package
v0.0.0-...-2096791 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package convert contains functions to innitialize Tink keysets from PEM-encoded data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PemFromECDSAP256Sha256WithDEREncodingKeysetHandle

func PemFromECDSAP256Sha256WithDEREncodingKeysetHandle(handle *keyset.Handle) ([]byte, error)

PemFromECDSAP256Sha256WithDEREncodingKeysetHandle converts a Tink Keyset with one EcdsaPublicKey (over curve P-256 using SHA256 and DER signature encoding) into a PEM-encoded key.

Note that the PEM encoded key does not have all the metadata the Tink key has. This can produce unexpected incompatibilities, see https://developers.google.com/tink/design/access_control#accessing_partial_keys

func PemFromRsaSsaPkcs1Sha256KeysetHandle

func PemFromRsaSsaPkcs1Sha256KeysetHandle(handle *keyset.Handle) ([]byte, error)

PemFromRsaSsaPkcs1Sha256KeysetHandle converts a Tink Keyset with one RsaSsaPkcs1PublicKey (using SHA256) into a PEM-encoded key.

Note that the PEM encoded key does not have all the metadata the Tink key has. This can produce unexpected incompatibilities, see https://developers.google.com/tink/design/access_control#accessing_partial_keys

func PemToECDSAP256Sha256WithDEREncodingKeysetHandle

func PemToECDSAP256Sha256WithDEREncodingKeysetHandle(pemBytes []byte) (*keyset.Handle, error)

PemToECDSAP256Sha256WithDEREncodingKeysetHandle converts a PEM-encoded byte slice into a Tink public Keyset.

ECDSA Signatures need to used the ASN.1 DER encoding.

The JWA RFC for ES256, ES384 and ES512 mandates a different encoding, so this generated with this class are not conformant with the JWA standard. See https://www.rfc-editor.org/rfc/rfc7518#section-3.4.

func PemToRsaSsaPkcs1Sha256KeysetHandle

func PemToRsaSsaPkcs1Sha256KeysetHandle(pemBytes []byte) (*keyset.Handle, error)

PemToRsaSsaPkcs1Sha256KeysetHandle converts a PEM-encoded byte slice into a Tink public Keyset.

Note that only OID "rsaEncryption" is supported. The OIDs "sha256WithRSAEncryption", "sha384WithRSAEncryption" and "sha512WithRSAEncryption" are not supported. See RFC 4055 Section 1.2 and Section 5 for a discussion of these OIDs.

func PemToRsaSsaPssSha256KeysetHandle

func PemToRsaSsaPssSha256KeysetHandle(pemBytes []byte) (*keyset.Handle, error)

PemToRsaSsaPssSha256KeysetHandle converts a PEM-encoded byte slice into a Tink public Keyset.

Note that only OID "rsaEncryption" is supported. The OID "id-RSASSA-PSS" is not supported. See RFC 4055 Section 1.2 for a discussion of these OIDs.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL