

@classmethod
def initialize(cls, output_path, authority, username, begin=None):
    '\n        Generate a certificate signed by the supplied root certificate.\n\n        :param FilePath output_path: Directory where the certificate will be\n            written.\n        :param CertificateAuthority authority: The certificate authority with\n            which this certificate will be signed.\n        :param unicode username: A UTF-8 encoded username to be included in\n            the certificate.\n        :param datetime begin: The datetime from which the generated\n            certificate should be valid.\n        '
    key_filename = (username + '.key')
    cert_filename = (username + '.crt')
    name = ('user-' + username)
    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, b'sha256', start=begin, additional_extensions=[crypto.X509Extension(b'extendedKeyUsage', False, b'clientAuth')])
    credential = FlockerCredential(path=output_path, keypair=keypair, certificate=cert)
    credential.write_credential_files(key_filename, cert_filename)
    instance = cls(credential=credential, username=username)
    return instance

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