PKCS #1 methods as defined in RFC 3447.
We cannot rely solely on the cryptography library, because the openssl package used by the cryptography library may not implement the md5-sha1 hash, as with Ubuntu or OSX. This is why we reluctantly keep some legacy crypto here.
I2OSP conversion function from RFC 3447. The length parameter allows the function to perform the padding needed. Note that the user is responsible for providing a sufficient xLen.
n – nonnegative integer to be converted
sLen – intended length of the resulting octet string
corresponding octet string
This is a log base 256 which determines the minimum octet string length for unequivocal representation of integer n by pkcs_i2osp.
OS2IP conversion function from RFC 3447.
s – octet string to be converted
n, the corresponding nonnegative integer