

@classmethod
def initialize(cls, path, authority, begin=None, uuid=None):
    '\n        Generate a certificate signed by the supplied root certificate.\n\n        :param FilePath path: Directory where the certificate will be stored.\n        :param CertificateAuthority authority: The certificate authority with\n            which this certificate will be signed.\n        :param datetime begin: The datetime from which the generated\n            certificate should be valid.\n        :param bytes uuid: The UUID to be included in this certificate.\n            Generated if not supplied.\n        '
    if (uuid is None):
        uuid = bytes(uuid4())
    key_filename = b'{uuid}.key'.format(uuid=uuid)
    cert_filename = b'{uuid}.crt'.format(uuid=uuid)
    name = b'{prefix}{uuid}'.format(prefix=cls._UUID_PREFIX, uuid=uuid)
    organizational_unit = authority.organizational_unit
    dn = DistinguishedName(commonName=name, organizationalUnitName=organizational_unit)
    keypair = flocker_keypair()
    request = keypair.keypair.requestObject(dn)
    serial = os.urandom(16).encode(b'hex')
    serial = int(serial, 16)
    cert = sign_certificate_request(authority.credential.keypair.keypair, authority.credential.certificate.original.get_subject(), request, serial, EXPIRY_20_YEARS, 'sha256', start=begin)
    credential = FlockerCredential(path=path, keypair=keypair, certificate=cert)
    credential.write_credential_files(key_filename, cert_filename)
    instance = cls(credential=credential)
    return instance

dataset/ETHPy150Open ClusterHQ/flocker/flocker/ca/_ca.py NodeCredential.initialize/original