Documentation ¶
Index ¶
- func Decrypt(ciphertext []byte, RSAPrivateKey *PrivateKey) (plaintext []byte, err error)
- func Encrypt(plaintext []byte, RSAPublicKey *PublicKey) (ciphertext []byte, err error)
- func GenerateKeyPair(bits int) (RSAPrivateKey *PrivateKey, RSAPublicKey *PublicKey, err error)
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
func Decrypt(ciphertext []byte, RSAPrivateKey *PrivateKey) (plaintext []byte, err error)
Decrypt 使用RSA私钥解密密文
func GenerateKeyPair ¶
func GenerateKeyPair(bits int) (RSAPrivateKey *PrivateKey, RSAPublicKey *PublicKey, err error)
GenerateKeyPair 生成RSA密钥对
Types ¶
type PrivateKey ¶
type PrivateKey struct {
Key *rsa.PrivateKey
}
func PEMKeyToPrivateKey ¶
func PEMKeyToPrivateKey(PEMKey []byte) (RSAPrivateKey *PrivateKey, err error)
func (*PrivateKey) ToPEM ¶
func (PrivateKey *PrivateKey) ToPEM() (PEMKey []byte, err error)
Click to show internal directories.
Click to hide internal directories.