class Crypto::RSA::KeyPair
- Crypto::RSA::KeyPair
- Reference
- Object
Defined in:
crypto/pubkey/rsa/key_pair.crConstructors
-
.new(private_key : Crypto::RSA::Key | Nil = nil, public_key : Crypto::RSA::Key | Nil = nil)
Initializes a new key pair.
Class Method Summary
Instance Method Summary
-
#bitsize
Returns the bit size of this key pair.
-
#bytesize
Returns the byte size of this key pair.
-
#decrypt(ciphertext)
Decrypts the given
ciphertext
using the private key from this key pair. -
#encrypt(plaintext)
Encrypts the given
plaintext
using the public key from this key pair. -
#modulus
Returns the RSA modulus for this key pair.
- #private_key : Key | Nil
- #public_key : Key | Nil
-
#sign(plaintext)
Signs the given
plaintext
using the private key from this key pair. -
#size
ditto
-
#valid?
Returns
true
if this is a valid RSA key pair according toPKCS1
. -
#verify(signature, plaintext)
Verifies the given
signature
using the public key from this key pair.
Constructor Detail
def self.new(private_key : Crypto::RSA::Key | Nil = nil, public_key : Crypto::RSA::Key | Nil = nil)
#
Initializes a new key pair.
Class Method Detail
Instance Method Detail
def verify(signature, plaintext)
#
Verifies the given signature
using the public key from this key
pair.