Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnexpectedPublicKeyFormat = errors.New("Unexpected public key format")
)
Errors
Functions ¶
This section is empty.
Types ¶
type KeyPair ¶
type KeyPair struct { PrivateKey *PrivateKey PublicKey *PublicKey }
KeyPair is a holder for a private key and a public key.
func GenerateKeyPair ¶
GenerateKeyPair generates a private-public keypair.
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey is a wrapper over rsa.PrivateKey.
func GeneratePrivateKey ¶
func GeneratePrivateKey() (*PrivateKey, error)
GeneratePrivateKey generates a PrivateKey.
func (*PrivateKey) DecryptOAEP ¶
func (pk *PrivateKey) DecryptOAEP(ciphertext []byte) ([]byte, error)
DecryptOAEP decrypts the ciphertext using RSA-OAEP.
func (*PrivateKey) GetPublicKey ¶
func (pk *PrivateKey) GetPublicKey() *PublicKey
GetPublicKey returns the public key based on this private key
func (*PrivateKey) Sign ¶
func (pk *PrivateKey) Sign(message []byte) ([]byte, error)
Sign signs the given message using this private key and returns the signature.
func (*PrivateKey) ToString ¶
func (pk *PrivateKey) ToString() string
ToString produces a string representation of this private key.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is a wrapper over rsa.PublicKey.
func PublicKeyFromBytes ¶
PublicKeyFromBytes returns a PublicKey given a slice of bytes in X509 PKIX public key format.
func (*PublicKey) EncryptOAEP ¶
EncryptOAEP encrypts the message using RSA-OAEP.
func (*PublicKey) ToBytes ¶
ToBytes returns a slice of bytes representing this public key in X509 PKIX public key format.
func (*PublicKey) VerifySignature ¶
VerifySignature verifies that the signature for this message was produced with the private key for which this is the public key.