Documentation ¶
Index ¶
- Variables
- func EncodeRsaDer(keytype Type, key *rsa.PrivateKey) ([]byte, error)
- func EncodeRsaPem(keytype Type, key *rsa.PrivateKey) ([]byte, error)
- func GenerateRsaKey(keysize int) (*rsa.PrivateKey, error)
- func ParsePemFile(filepath string) ([]*pem.Block, error)
- func StoreRsaDer(keytype Type, key *rsa.PrivateKey, filepath string, perm os.FileMode) error
- func StoreRsaPem(keytype Type, key *rsa.PrivateKey, filepath string, perm os.FileMode) error
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrType indicates an invalid option for a key (Public/Private) ErrType = errors.New("Invalid key type") // ErrConvert indicates that the key could not be converted to bytes ErrConvert = errors.New("Cannot convert key to bytes") )
Functions ¶
func EncodeRsaDer ¶
func EncodeRsaDer(keytype Type, key *rsa.PrivateKey) ([]byte, error)
EncodeRsaDer encodes an RSA key into a slice of DER bytes
func EncodeRsaPem ¶
func EncodeRsaPem(keytype Type, key *rsa.PrivateKey) ([]byte, error)
EncodeRsaPem encodes an RSA key into a slice of PEM bytes
func GenerateRsaKey ¶
func GenerateRsaKey(keysize int) (*rsa.PrivateKey, error)
GenerateRsaKey is a wrapper function around rsa.GenerateKey function.
func ParsePemFile ¶
ParsePemFile reads and marshals a key from an io.Reader
func StoreRsaDer ¶
StoreRsaDer writes a RSA key in DER byte format to file.
func StoreRsaPem ¶
StoreRsaPem writes RSA keys to file in PEM format
Types ¶
Click to show internal directories.
Click to hide internal directories.