keyio

package
v0.1.6-0...-5c25bcb Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPrimaryPublicKey

func ExtractPrimaryPublicKey(kh *keyset.Handle) (*cryptoapi.PublicKey, error)

ExtractPrimaryPublicKey is a utility function that will extract the main public key from *keyset.Handle kh.

func PublicKeyToKeysetHandle

func PublicKeyToKeysetHandle(pubKey *cryptoapi.PublicKey) (*keyset.Handle, error)

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

func PublicKeyToKeysetHandleXChacha(pubKey *cryptoapi.PublicKey) (*keyset.Handle, error)

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.

Jump to

Keyboard shortcuts

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