class Crypto::RSA::KeyPair

Defined in:

crypto/pubkey/rsa/key_pair.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(private_key : Crypto::RSA::Key | Nil = nil, public_key : Crypto::RSA::Key | Nil = nil) #

Initializes a new key pair.


[View source]

Class Method Detail

def self.generate(bits, exponent = 65537, accurate = true) #

[View source]

Instance Method Detail

def bitsize #

Returns the bit size of this key pair.


[View source]
def bytesize #

Returns the byte size of this key pair.


[View source]
def decrypt(ciphertext) #

Decrypts the given ciphertext using the private key from this key pair.


[View source]
def encrypt(plaintext) #

Encrypts the given plaintext using the public key from this key pair.


[View source]
def modulus #

Returns the RSA modulus for this key pair.


[View source]
def private_key : Key | Nil #

[View source]
def public_key : Key | Nil #

[View source]
def sign(plaintext) #

Signs the given plaintext using the private key from this key pair.


[View source]
def size #

ditto


[View source]
def valid? #

Returns true if this is a valid RSA key pair according to PKCS1.


[View source]
def verify(signature, plaintext) #

Verifies the given signature using the public key from this key pair.


[View source]