Documentation ¶
Index ¶
- Variables
- func SetLogLevel(level log4go.Level)
- type Cipher
- type CipherMode
- type Key
- func LoadKeyFromDerFile(publicKeyFilePath, privateKeyFilePath string, ...) (Key, error)
- func LoadKeyFromPEMByte(pukBytes, prkBytes []byte, ParseKey func([]byte, []byte) (Key, error)) (Key, error)
- func LoadKeyFromPEMFile(publicKeyFilePath, privateKeyFilePath string, ...) (Key, error)
- func ParsePKCS1Key(publicKey, privateKey []byte) (Key, error)
- func ParsePKCS1KeyByCert(publicKey, privateKey []byte) (Key, error)
- func ParsePKCS1PriKey(privateKey []byte) (Key, error)
- func ParsePKCS1PubKey(publicKey []byte) (Key, error)
- func ParsePKCS8Key(publicKey, privateKey []byte) (Key, error)
- func ParsePKCS8PriKey(privateKey []byte) (Key, error)
- func ParsePKCS8PubKey(publicKey []byte) (Key, error)
- type Padding
- type SignMode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDataToLarge = errors.New("message too long for RSA public key size") ErrDataLen = errors.New("data length error") ErrDataBroken = errors.New("data broken, first byte is not zero") ErrKeyPairDismatch = errors.New("data is not encrypted by the private key") ErrDecryption = errors.New("decryption error") )
Functions ¶
func SetLogLevel ¶
func SetLogLevel(level log4go.Level)
Types ¶
type Cipher ¶
type Cipher interface { Encrypt(plainText []byte) ([]byte, error) Decrypt(cipherText []byte) ([]byte, error) Sign(src []byte, hash crypto.Hash) ([]byte, error) Verify(src []byte, sign []byte, hash crypto.Hash) error EncryptPri(plainText []byte) ([]byte, error) DecryptPub(cipherText []byte) ([]byte, error) }
type CipherMode ¶
type CipherMode interface { Encrypt(plainText []byte, puk *rsa.PublicKey) ([]byte, error) Decrypt(cipherText []byte, prk *rsa.PrivateKey) ([]byte, error) }
func NewOAEPCipher ¶
func NewOAEPCipher() CipherMode
func NewPKCS1v15Cipher ¶
func NewPKCS1v15Cipher() CipherMode
type Key ¶
type Key interface { PublicKey() *rsa.PublicKey PrivateKey() *rsa.PrivateKey Modulus() int }
func LoadKeyFromDerFile ¶
func LoadKeyFromPEMByte ¶
func LoadKeyFromPEMFile ¶
func ParsePKCS1Key ¶
func ParsePKCS1KeyByCert ¶
func ParsePKCS1PriKey ¶
func ParsePKCS1PubKey ¶
func ParsePKCS8Key ¶
func ParsePKCS8PriKey ¶
func ParsePKCS8PubKey ¶
Click to show internal directories.
Click to hide internal directories.