module Crypto::RSA::PKCS1
Overview
Support for the PKCS #1 (aka RFC 3447) padding schemes.
Defined in:
crypto/pubkey/rsa/pkcs1.crClass Method Summary
-
.i2osp(x, len = nil)
Converts a nonnegative integer into an octet string of a specified length.
-
.os2ip(x)
Converts an octet string into a nonnegative integer.
-
.rsadp(k, c)
Recovers the message representative from a ciphertext representative under the control of a private key.
-
.rsaep(k, m)
Produces a ciphertext representative from a message representative under the control of a public key.
-
.rsasp1(k, m)
Produces a signature representative from a message representative under the control of a private key.
-
.rsavp1(k, s)
Recovers the message representative from a signature representative under the control of a public key.
Class Method Detail
Converts a nonnegative integer into an octet string of a specified length.
This is the PKCS #1 I2OSP (Integer-to-Octet-String) primitive. Refer to PKCS #1 v2.1 pp. 8-9, section 4.1.
Example
RSA::PKCS1.i2osp(9_202_000, 2) # => ArgumentError: integer too large
RSA::PKCS1.i2osp(9_202_000, 3) # => "\x8C\x69\x50"
RSA::PKCS1.i2osp(9_202_000, 4) # => "\x00\x8C\x69\x50"
Converts an octet string into a nonnegative integer.
This is the PKCS #1 OS2IP (Octet-String-to-Integer) primitive. Refer to PKCS #1 v2.1 p. 9, section 4.2.
Example
RSA::PKCS1.os2ip("\x8C\x69\x50") # => 9_202_000
Recovers the message representative from a ciphertext representative under the control of a private key.
This is the PKCS #1 RSADP decryption primitive. Refer to PKCS #1 v2.1 pp. 10-11, section 5.1.2.
Produces a ciphertext representative from a message representative under the control of a public key.
This is the PKCS #1 RSAEP encryption primitive. Refer to PKCS #1 v2.1 p. 10, section 5.1.1.
Produces a signature representative from a message representative under the control of a private key.
This is the PKCS #1 RSASP1 signature primitive. Refer to PKCS #1 v2.1 pp. 12-13, section 5.2.1.
Recovers the message representative from a signature representative under the control of a public key.
This is the PKCS #1 RSAVP1 verification primitive. Refer to PKCS #1 v2.1 p. 13, section 5.2.2.