Crypto::RSA::PKCS1
Support for the PKCS #1 (aka RFC 3447) padding schemes.
Class methods
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.