@classmethod
    def from_files(cls, certificate_path, key_path):
        certificate = load_certificate_file(certificate_path)
        keypair = load_key_file(key_path)
        dn = certificate.getSubject()
        # Convert the common name to a string and remove the "user-" prefix
        # to extract the actual username.
        username = dn.CN.decode("utf-8").replace(u"user-", u"", 1)
        # We have no need for the ``path`` attribute on FlockerCredential
        # except when we write the files, so for now we can set this to the
        # directory of the certificate path.
        # FlockerCredential should be modified to not work like this though.
        # See FLOC-2414
        credential = FlockerCredential(
            path=certificate_path.parent(),
            keypair=keypair,
            certificate=certificate
        )
        return cls(credential=credential, username=username)
Load a user certificate and keypair from the specified file paths.
dataset/ETHPy150Open ClusterHQ/flocker/flocker/ca/_ca.py/UserCredential.from_files