Documentation ¶
Index ¶
- Constants
- Variables
- func EncryptKey(k KeyInfo, plaintext []byte) ([]byte, error)
- func GenerateRSAKey(keySize int) (*rsa.PrivateKey, error)
- func LoadPEMPrivateKey(fn string) (*rsa.PrivateKey, error)
- func LoadPEMPublicKey(fn string) (*rsa.PublicKey, error)
- func NewPlaintextKey(k KeyInfo) ([]byte, error)
- func PlaintextKey(k KeyInfo, image string) ([]byte, error)
- func SavePrivatePEM(fileName string, key *rsa.PrivateKey) error
- func SavePublicPEM(fileName string, key *rsa.PrivateKey) error
- type KeyInfo
Constants ¶
View Source
const ( // Unknown indicates the key material format is not known. Unknown = iota // Passphrase indicates the key material is formatted as a passphrase. Passphrase // PEM indicates the key material is formatted as a PEM file. PEM )
View Source
const ( // DefaultKeySize is the default size of the key that is used when a // size is not explicitly specified DefaultKeySize = 2048 )
Variables ¶
View Source
var ( // ErrEncryptedKeyNotFound indicates the encrypted key is not found. ErrEncryptedKeyNotFound = errors.New("encrypted key not found") // ErrUnsupportedKeyURI indicates the key URI is not supported. ErrUnsupportedKeyURI = errors.New("unsupported key URI") // ErrNoEncryptedKeyData indicates there is no encrypted key data. ErrNoEncryptedKeyData = errors.New("no encrypted key data") // ErrNoPEMData indicates there is no PEM data. ErrNoPEMData = errors.New("No PEM data") )
Functions ¶
func GenerateRSAKey ¶
func GenerateRSAKey(keySize int) (*rsa.PrivateKey, error)
GenerateRSAKey creates a new RSA key of length keySize.
func LoadPEMPrivateKey ¶
func LoadPEMPrivateKey(fn string) (*rsa.PrivateKey, error)
func NewPlaintextKey ¶
func SavePrivatePEM ¶
func SavePrivatePEM(fileName string, key *rsa.PrivateKey) error
SavePrivatePEM saves a private PEM key into a file.
func SavePublicPEM ¶
func SavePublicPEM(fileName string, key *rsa.PrivateKey) error
SavePublicPEM saves a public PEM key into a file.
Types ¶
Click to show internal directories.
Click to hide internal directories.