Documentation ¶
Index ¶
- func RsaDecode(data string, private []byte) ([]byte, error)
- func RsaEncrypt(orgidata, publickey []byte) (string, error)
- func Sign(plant []byte, private []byte) (string, error)
- func Sign256(plant []byte, private []byte) (string, error)
- func Verify(sign string, plant []byte, public []byte) (bool, error)
- func VerityRsaKey(key []byte) error
- type Cipher
- type CipherMode
- type Key
- func LoadKeyFromPEMFile(publicKeyFilePath, privateKeyFilePath string, ...) (Key, error)
- func ParsePKCS1Key(publicKey, privateKey []byte) (Key, error)
- func ParsePKCS1KeyPrivate(privateKey []byte) (Key, error)
- func ParsePKCS1KeyPublic(publicKey []byte) (Key, error)
- func ParsePKCS8Key(publicKey, privateKey []byte) (Key, error)
- type Padding
- type SignMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RsaEncrypt ¶
func VerityRsaKey ¶ added in v0.0.32
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 }
func NewCipher ¶
func NewCipher(key Key, padding Padding, cipherMode CipherMode, signMode SignMode) Cipher
func NewRSAWith ¶
type CipherMode ¶
type CipherMode interface { Encrypt(plainText []byte, puk *rsa.PublicKey) ([]byte, error) Decrypt(cipherText []byte, prk *rsa.PrivateKey) ([]byte, error) }
func NewPKCS1v15Cipher ¶
func NewPKCS1v15Cipher() CipherMode
type Key ¶
type Key interface { PublicKey() *rsa.PublicKey PrivateKey() *rsa.PrivateKey Modulus() int }
func LoadKeyFromPEMFile ¶
func ParsePKCS1Key ¶
func ParsePKCS1KeyPrivate ¶
func ParsePKCS1KeyPublic ¶
func ParsePKCS8Key ¶
Click to show internal directories.
Click to hide internal directories.