encrypters

package
v2.0.11-0...-ba100f2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyEncrypter

type KeyEncrypter struct {
	Secret []byte
	Crypto ubirch.Crypto
}

func NewKeyEncrypter

func NewKeyEncrypter(secret []byte, crypto ubirch.Crypto) (*KeyEncrypter, error)

func (*KeyEncrypter) Decrypt

func (enc *KeyEncrypter) Decrypt(encryptedPrivateKey []byte) (privateKeyPem []byte, err error)

Decrypt takes a AES256-encrypted DER-encoded PKCS#8 private key, decrypts it using a 32 byte secret and returns the decrypted PEM-encoded private key

func (*KeyEncrypter) Encrypt

func (enc *KeyEncrypter) Encrypt(privateKeyPem []byte) ([]byte, error)

Encrypt takes a PEM-encoded private key, AES256-encrypts it using a 32 byte secret and returns the encrypted DER-encoded PKCS#8 private key

Jump to

Keyboard shortcuts

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