secret

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeyID

func GenerateKeyID(publicKeyDER []byte) (string, error)

GenerateKeyID will compute a SHA1-hash of the public key der bytes and use the first keyIDLength characters as the key id (kid) to return.

func Marshal

func Marshal(keyID string, pub, pvt *pem.Block) ([]byte, error)

Marshal implements the MarshalJSON interface for secrets.

func MarshalPEMBlock

func MarshalPEMBlock(block *pem.Block) string

MarshalPEMBlock will marshal the PEM block in a way that will allow marshaling in a JSON payload.

Types

type ECDSA

type ECDSA struct {
	Private *ecdsa.PrivateKey
	Public  crypto.PublicKey
}

ECDSA provides capabilities around marshaling a ECDSA key pair for the Coral Project's Talk.

func NewECDSA

func NewECDSA(curve elliptic.Curve) (*ECDSA, error)

NewECDSA will generate a ECDSA key using the crypto/rand.Reader source with a length of bitSize.

func (ECDSA) MarshalJSON

func (s ECDSA) MarshalJSON() ([]byte, error)

MarshalJSON implements the MarshalJSON interface.

type RSA

type RSA struct {
	Private *rsa.PrivateKey
	Public  crypto.PublicKey
}

RSA provides capabilities around marshaling a RSA key pair for the Coral Project's Talk.

func NewRSA

func NewRSA(bitSize int) (*RSA, error)

NewRSA will generate a RSA key using the crypto/rand.Reader source with a length of bitSize.

func (RSA) MarshalJSON

func (s RSA) MarshalJSON() ([]byte, error)

MarshalJSON implements the MarshalJSON interface.

Jump to

Keyboard shortcuts

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