Versions in this module Expand all Collapse all v1 v1.0.5 Nov 5, 2024 Changes in this version + var ErrInvalidPadding = errors.New("invalid padding") + var Nil *interface + func AESCBCDecrypt(ciphertext, key, iv []byte, padding Padding) ([]byte, error) + func AESCBCDecryptWithSalt(data, key []byte, iter int, magic string, padding Padding, h func() hash.Hash) ([]byte, error) + func AESCBCEncrypt(plaintext, key, iv []byte, padding Padding) ([]byte, error) + func AESCBCEncryptWithSalt(plaintext, key []byte, iter int, magic string, padding Padding, ...) ([]byte, error) + func AESCFBDecrypt(ciphertext, key, iv []byte, padding Padding) ([]byte, error) + func AESCFBEncrypt(plaintext, key, iv []byte, padding Padding) ([]byte, error) + func AESDecryptWithSalt(ciphertext, key []byte, iterCount int, magic string, h func() hash.Hash, ...) ([]byte, error) + func AESECBDecrypt(ciphertext, key []byte, padding Padding) ([]byte, error) + func AESECBEncrypt(plaintext, key []byte, padding Padding) ([]byte, error) + func AESEncryptWithSalt(plaintext, key []byte, iter int, magic string, h func() hash.Hash, ...) ([]byte, error) + func AESGCMDecrypt(ciphertext, key, additional []byte) ([]byte, error) + func AESGCMDecryptWithNonce(ciphertext, key, nonce, additional []byte) ([]byte, error) + func AESGCMEncrypt(plaintext, key, additional []byte) ([]byte, error) + func AESGCMEncryptWithNonce(plaintext, key, nonce, additional []byte) ([]byte, error) + func DecodeCertificate(data []byte) (*x509.Certificate, error) + func GenerateRSAKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error) + func HmacMD5(data, key []byte) []byte + func HmacSHA1(data, key []byte) []byte + func HmacSHA256(data, key []byte) []byte + func HmacSHA512(data, key []byte) []byte + func MD5(value []byte) []byte + func RSADecrypt(ciphertext []byte, key *rsa.PrivateKey) ([]byte, error) + func RSAEncrypt(plaintext []byte, key *rsa.PublicKey) ([]byte, error) + func RSASignPKCS1v15(plaintext []byte, key *rsa.PrivateKey, hash crypto.Hash) ([]byte, error) + func RSAVerifyPKCS1v15(ciphertext, signature []byte, key *rsa.PublicKey, hash crypto.Hash) error + func RandBytes(length int) (data []byte, err error) + func SHA1(value []byte) []byte + func SHA256(value []byte) []byte + func SHA512(value []byte) []byte + type NoPadding struct + func (p NoPadding) Pad(src []byte, blockSize int) ([]byte, error) + func (p NoPadding) UnPad(src []byte, blockSize int) ([]byte, error) + type PKCS1PrivateKey struct + func (p PKCS1PrivateKey) RSAPrivateKey() (*rsa.PrivateKey, error) + type PKCS1PublicKey struct + func (p PKCS1PublicKey) RSAPublicKey() (*rsa.PublicKey, error) + type PKCS5Padding struct + func (p PKCS5Padding) Pad(src []byte, blockSize int) ([]byte, error) + func (p PKCS5Padding) UnPad(src []byte, blockSize int) ([]byte, error) + type PKCS7Padding struct + func (p PKCS7Padding) Pad(src []byte, blockSize int) ([]byte, error) + func (p PKCS7Padding) UnPad(src []byte, blockSize int) ([]byte, error) + type PKCS8PrivateKey struct + func (p PKCS8PrivateKey) ECDSAPrivateKey() (*ecdsa.PrivateKey, error) + func (p PKCS8PrivateKey) ED25519PrivateKey() (*ed25519.PrivateKey, error) + func (p PKCS8PrivateKey) PrivateKey() (interface{}, error) + func (p PKCS8PrivateKey) RSAPrivateKey() (*rsa.PrivateKey, error) + type PKIXPublicKey struct + func (p PKIXPublicKey) ECDSAPublicKey() (*ecdsa.PublicKey, error) + func (p PKIXPublicKey) ED25519PublicKey() (*ed25519.PublicKey, error) + func (p PKIXPublicKey) PublicKey() (interface{}, error) + func (p PKIXPublicKey) RSAPublicKey() (*rsa.PublicKey, error) + type Padding interface + Pad func(src []byte, blockSize int) ([]byte, error) + UnPad func(src []byte, blockSize int) ([]byte, error) + type PrivateKey interface + Public func() crypto.PublicKey + type PrivateKeyDecoder []byte + func DecodePrivateKey(data []byte) PrivateKeyDecoder + func (p PrivateKeyDecoder) PKCS1() PKCS1PrivateKey + func (p PrivateKeyDecoder) PKCS8() PKCS8PrivateKey + type PrivateKeyEncoder struct + func EncodePrivateKey(key PrivateKey) PrivateKeyEncoder + func (p PrivateKeyEncoder) PKCS1() ([]byte, error) + func (p PrivateKeyEncoder) PKCS8() ([]byte, error) + type PublicKey interface + type PublicKeyDecoder []byte + func DecodePublicKey(data []byte) PublicKeyDecoder + func (p PublicKeyDecoder) PKCS1() PKCS1PublicKey + func (p PublicKeyDecoder) PKIX() PKIXPublicKey + type PublicKeyEncoder struct + func EncodePublicKey(key PublicKey) PublicKeyEncoder + func (p PublicKeyEncoder) PKCS1() ([]byte, error) + func (p PublicKeyEncoder) PKIX() ([]byte, error) + type ZeroPadding struct + func (p ZeroPadding) Pad(src []byte, blockSize int) ([]byte, error) + func (p ZeroPadding) UnPad(src []byte, blockSize int) ([]byte, error)