Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractPrimaryPublicKey ¶
ExtractPrimaryPublicKey is a utility function that will extract the main public key from *keyset.Handle kh.
func PublicKeyToKeysetHandle ¶
PublicKeyToKeysetHandle converts pubKey into a *keyset.Handle where pubKey could be either a sender or a recipient key. The resulting handle cannot be directly used for primitive execution as the cek is not set. This function serves as a helper to get a senderKH to be used as an option for ECDH execution (for ECDH-1PU/authcrypt). The keyset handle will be set with AES256-GCM AEAD key template for content encryption with NIST P KW.
func PublicKeyToKeysetHandleXChacha ¶
PublicKeyToKeysetHandleXChacha converts pubKey into a *keyset.Handle where pubKey could be either a sender or a recipient key. The resulting handle cannot be directly used for primitive execution as the cek is not set. This as a helper to get a senderKH to be used as an option for ECDH execution (for ECDH-1PU/authcrypt). The keyset handle will be set with XChacha20Poly1305 AEAD key template for content encryption with X25519 KW.
Types ¶
type PubKeyWriter ¶
type PubKeyWriter struct {
// contains filtered or unexported fields
}
PubKeyWriter will write the raw bytes of a Tink KeySet's primary public key. The raw bytes are a marshaled composite.VerificationMethod type. The keyset must have a keyURL value equal to either one of the public key URLs:
- `nistPECDHKWPublicKeyTypeURL`
- `x25519ECDHKWPublicKeyTypeURL`
constants of ecdh package. Note: This writer should be used only for ECDH public key exports. Other export of public keys should be
called via localkms package.
func NewWriter ¶
func NewWriter(w io.Writer) *PubKeyWriter
NewWriter creates a new PubKeyWriter instance.
func (*PubKeyWriter) Write ¶
func (p *PubKeyWriter) Write(ks *tinkpb.Keyset) error
Write writes the public keyset to the underlying w.Writer.
func (*PubKeyWriter) WriteEncrypted ¶
func (p *PubKeyWriter) WriteEncrypted(_ *tinkpb.EncryptedKeyset) error
WriteEncrypted writes the encrypted keyset to the underlying w.Writer.