net/data/gencerts/__init__.py
def make_serial_number(self):
    """Returns a hex number that is generated based on the certificate file
    path. This serial number will likely be globally unique, which makes it
    easier to use the certificates with NSS (which assumes certificate
    equivalence based on issuer and serial number)."""

    # Hash some predictable values together to get the serial number. The
    # predictability is so that re-generating certificate chains is
    # a no-op, however each certificate ends up with a unique serial number.
    m = hashlib.sha1()

    # Mix in up to the last 3 components of the path for the generating script.
    # For example,
    # "verify_certificate_chain_unittest/my_test/generate_chains.py"
    script_path = os.path.realpath(g_invoking_script_path)
    script_path = "/".join(script_path.split(os.sep)[-3:])
    m.update(script_path)

    # Mix in the path_id, which corresponds to a unique path for the
    # certificate under out/ (and accounts for non-unique certificate names).
    m.update(self.path_id)

    serial_bytes = m.digest()

    # SHA1 digest is 20 bytes long, which is appropriate for a serial number.
    # However, need to also make sure the most significant bit is 0 so it is
    # not a "negative" number.
    serial_bytes = chr(ord(serial_bytes[0]) & 0x7F) + serial_bytes[1:]

    return serial_bytes.encode("hex")
Returns a hex number that is generated based on the certificate file
    path. This serial number will likely be globally unique, which makes it
    easier to use the certificates with NSS (which assumes certificate
    equivalence based on issuer and serial number).
Returns a hex number that is generated based on the certificate file
path. This serial number will likely be globally unique, which makes it
easier to use the certificates with NSS (which assumes certificate
equivalence based on issuer and serial number).
Returns a hex number that is generated based on the certificate file path . This serial number will likely be globally unique which makes it easier to use the certificates with NSS ( which assumes certificate equivalence based on issuer and serial number ) .
def make_serial_number(self):
    m = hashlib.sha1()
    script_path = os.path.realpath(g_invoking_script_path)
    script_path = "/".join(script_path.split(os.sep)[-3:])
    m.update(script_path)
    m.update(self.path_id)
    serial_bytes = m.digest()
    serial_bytes = chr(ord(serial_bytes[0]) & 0x7F) + serial_bytes[1:]
    return serial_bytes.encode("hex")
def make_serial_number ( self ) : m = hashlib . sha1 ( ) script_path = os . path . realpath ( g_invoking_script_path ) script_path = "/" . join ( script_path . split ( os . sep ) [ - 3 : ] ) m . update ( script_path ) m . update ( self . path_id ) serial_bytes = m . digest ( ) serial_bytes = chr ( ord ( serial_bytes [ 0 ] ) & 0x7F ) + serial_bytes [ 1 : ] return serial_bytes . encode ( "hex" )
Returns a hex number that is generated based on the certificate file
path.
Returns a hex number that is generated based on the certificate file path .
"""Returns a hex number that is generated based on the certificate file
    path. This serial number will likely be globally unique, which makes it
    easier to use the certificates with NSS (which assumes certificate
    equivalence based on issuer and serial number).""" # Hash some predictable values together to get the serial number. The # predictability is so that re-generating certificate chains is # a no-op, however each certificate ends up with a unique serial number. # Mix in up to the last 3 components of the path for the generating script. # For example, # "verify_certificate_chain_unittest/my_test/generate_chains.py" # Mix in the path_id, which corresponds to a unique path for the # certificate under out/ (and accounts for non-unique certificate names). # SHA1 digest is 20 bytes long, which is appropriate for a serial number. # However, need to also make sure the most significant bit is 0 so it is # not a "negative" number.
self