Documentation ¶
Index ¶
- func GeneratePrivateKey(bits int) (*rsa.PrivateKey, error)
- func Pem2PrivateKey(privateKeyStr []byte) (*rsa.PrivateKey, error)
- func Pem2PublicKey(publicPem []byte) (*rsa.PublicKey, error)
- func PrivateKey2Pem(privateKey *rsa.PrivateKey) []byte
- func PublicKey2Pem(publicKey *rsa.PublicKey) []byte
- type Rsa
- func (r *Rsa) Decrypt(ciphertext []byte, priv *rsa.PrivateKey) ([]byte, error)
- func (r *Rsa) Encrypt(msg []byte, pub *rsa.PublicKey) ([]byte, error)
- func (r *Rsa) Sign(privateKey *rsa.PrivateKey, content []byte) ([]byte, error)
- func (r *Rsa) VerifySign(publicKey *rsa.PublicKey, sign []byte, content []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePrivateKey ¶
func GeneratePrivateKey(bits int) (*rsa.PrivateKey, error)
GeneratePrivateKey generates an RSA private key.
func Pem2PrivateKey ¶
func Pem2PrivateKey(privateKeyStr []byte) (*rsa.PrivateKey, error)
PemToPrivateKey converts a PEM-encoded private key to an *rsa.PrivateKey.
func Pem2PublicKey ¶
PemToPublicKey converts a PEM-encoded public key to an *rsa.PublicKey.
func PrivateKey2Pem ¶
func PrivateKey2Pem(privateKey *rsa.PrivateKey) []byte
PrivateKeyToPem converts an *rsa.PrivateKey to a PEM-encoded private key.
func PublicKey2Pem ¶
PublicKeyToPem converts an *rsa.PublicKey to a PEM-encoded public key.
Types ¶
type Rsa ¶
type Rsa struct {
// contains filtered or unexported fields
}
RsaEncryption represents an RSA encryption scheme.
Click to show internal directories.
Click to hide internal directories.