class

Crypto::RSA::KeyPair

Inherits Reference / Object

Constructors

new(private_key : Crypto::RSA::Key | Nil = nil, public_key : Crypto::RSA::Key | Nil = nil)

Initializes a new key pair.

Source

Class methods

generate(bits, exponent = 65537, accurate = true)
Source

Instance methods

bitsize

Returns the bit size of this key pair.

Source
bytesize

Returns the byte size of this key pair.

Source
decrypt(ciphertext)

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

Source
encrypt(plaintext)

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

Source
modulus

Returns the RSA modulus for this key pair.

Source
private_key
Source
public_key
Source
sign(plaintext)

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

Source
size

ditto

Source
valid?

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

Source
verify(signature, plaintext)

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

Source