scapy.layers.tls.crypto.pkcs1

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.

class scapy.layers.tls.crypto.pkcs1.MD5_SHA1[源代码]

基类:HashAlgorithm

block_size = 64
digest_size = 36
name = 'md5-sha1'
scapy.layers.tls.crypto.pkcs1.pkcs_i2osp(n, sLen)[源代码]

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

scapy.layers.tls.crypto.pkcs1.pkcs_ilen(n)[源代码]

This is a log base 256 which determines the minimum octet string length for unequivocal representation of integer n by pkcs_i2osp.

scapy.layers.tls.crypto.pkcs1.pkcs_os2ip(s)[源代码]

OS2IP conversion function from RFC 3447.

参数:

s -- octet string to be converted

返回:

n, the corresponding nonnegative integer