Documentation
¶
Index ¶
- Constants
- Variables
- func AESDecrypt(data, key []byte) ([]byte, error)
- func AESEncrypt(data, key []byte) ([]byte, error)
- func ExportRSAPrivateKeyBlob(key *rsa.PrivateKey, usage int) ([]byte, error)
- func ExportRSAPublicKeyBlob(key *rsa.PublicKey, usage int) ([]byte, error)
- func ImportRSAPrivateKeyBlob(data []byte) (*rsa.PrivateKey, error)
- func ImportRSAPublicKeyBlob(data []byte) (*rsa.PublicKey, error)
- func ParseRSAPrivateKey(der []byte) (*rsa.PrivateKey, error)
- func ParseRSAPrivateKeyPEM(data []byte) (*rsa.PrivateKey, error)
- func ParseRSAPublicKey(der []byte) (*rsa.PublicKey, error)
- func ParseRSAPublicKeyPEM(data []byte) (*rsa.PublicKey, error)
Constants ¶
const ( AESBlockSize = 16 AESIVSize = 16 )
about AES block and IV.
const ( RSAKeyUsageSIGN = 1 RSAKeyUsageKEYX = 2 )
about RSA key usage.
Variables ¶
var ( ErrEmptyPlainData = errors.New("empty aes plain data") ErrEmptyCipherData = errors.New("empty aes cipher data") ErrInvalidCipherData = errors.New("invalid aes cipher data") ErrInvalidPaddingSize = errors.New("invalid aes padding size") )
errors about AESEncrypt and AESDecrypt.
Functions ¶
func AESDecrypt ¶
AESDecrypt is used to decrypt data with CBC mode and PKCS#5 padding method.
func AESEncrypt ¶
AESEncrypt is used to encrypt data with CBC mode and PKCS#5 padding method.
func ExportRSAPrivateKeyBlob ¶
func ExportRSAPrivateKeyBlob(key *rsa.PrivateKey, usage int) ([]byte, error)
ExportRSAPrivateKeyBlob is used to export rsa private key with PrivateKeyBlob.
func ExportRSAPublicKeyBlob ¶
ExportRSAPublicKeyBlob is used to export rsa public key with PublicKeyBlob.
func ImportRSAPrivateKeyBlob ¶
func ImportRSAPrivateKeyBlob(data []byte) (*rsa.PrivateKey, error)
ImportRSAPrivateKeyBlob is used to import rsa private key with PrivateKeyBlob.
func ImportRSAPublicKeyBlob ¶
ImportRSAPublicKeyBlob is used to import rsa public key with PublicKeyBlob.
func ParseRSAPrivateKey ¶
func ParseRSAPrivateKey(der []byte) (*rsa.PrivateKey, error)
ParseRSAPrivateKey is used to load rsa private key from ASN.1 DER data.
func ParseRSAPrivateKeyPEM ¶
func ParseRSAPrivateKeyPEM(data []byte) (*rsa.PrivateKey, error)
ParseRSAPrivateKeyPEM is used to load rsa private key from PEM block.
func ParseRSAPublicKey ¶
ParseRSAPublicKey is used to load rsa public key from ASN.1 DER data.
Types ¶
This section is empty.