net/data/ssl/scripts/crlsetutil.py
def der_cert_to_serial(der_bytes):
  """Gets the serial of a DER-encoded certificate, omitting leading 0x00

  Args:
    der_bytes: A DER-encoded certificates (RFC 5280)

  Returns:
    The encoded serial number value (omitting tag and length), and omitting
    any leading 0x00 used to indicate it is a positive INTEGER.
  """
  iterator = ASN1Iterator(der_bytes)
  iterator.step_into()  # enter certificate structure
  iterator.step_into()  # enter TBSCertificate
  iterator.step_over()  # over version
  raw_serial = iterator.encoded_value()
  if six.indexbytes(raw_serial, 0) == 0x00 and len(raw_serial) > 1:
    raw_serial = raw_serial[1:]
  return raw_serial
Gets the serial of a DER-encoded certificate, omitting leading 0x00

  Args:
    der_bytes: A DER-encoded certificates (RFC 5280)

  Returns:
    The encoded serial number value (omitting tag and length), and omitting
    any leading 0x00 used to indicate it is a positive INTEGER.
  
Gets the serial of a DER-encoded certificate, omitting leading 0x00
Gets the serial of a DER - encoded certificate omitting leading 0x00
def der_cert_to_serial(der_bytes):
  iterator = ASN1Iterator(der_bytes)
  iterator.step_into()  
  iterator.step_into()  
  iterator.step_over()  
  raw_serial = iterator.encoded_value()
  if six.indexbytes(raw_serial, 0) == 0x00 and len(raw_serial) > 1:
    raw_serial = raw_serial[1:]
  return raw_serial
def der_cert_to_serial ( der_bytes ) : iterator = ASN1Iterator ( der_bytes ) iterator . step_into ( ) iterator . step_into ( ) iterator . step_over ( ) raw_serial = iterator . encoded_value ( ) if six . indexbytes ( raw_serial , 0 ) == 0x00 and len ( raw_serial ) > 1 : raw_serial = raw_serial [ 1 : ] return raw_serial
Gets the serial of a DER-encoded certificate, omitting leading 0x00
Gets the serial of a DER - encoded certificate omitting leading 0x00
"""Gets the serial of a DER-encoded certificate, omitting leading 0x00

  Args:
    der_bytes: A DER-encoded certificates (RFC 5280)

  Returns:
    The encoded serial number value (omitting tag and length), and omitting
    any leading 0x00 used to indicate it is a positive INTEGER.
  """ # enter certificate structure # enter TBSCertificate # over version
The encoded serial number value (omitting tag and length), and omitting
any leading 0x00 used to indicate it is a positive INTEGER.
The encoded serial number value ( omitting tag and length ) and omitting any leading 0x00 used to indicate it is a positive INTEGER .
der_bytes
A DER-encoded certificates (RFC 5280)
A DER - encoded certificates ( RFC 5280 )