def from_pem(cls, pem): """ :param pem: A private key previously encoded as PEM. :type pem: ``bytes`` :rtype: :class:`~core.PrivateKey` """ return PrivateKey(ECPrivateKey.from_pem(pem))
def __init__(self, server_sk=None, server_pk=None): if server_sk is not None: self.server_sk = PrivateKey.from_pem(server_sk) self.server_sk = server_sk self.server_pk = None if server_pk is not None: if isinstance(server_pk, str): self.server_pk = hex2pub(server_pk) elif isinstance(server_pk, bytes): self.server_pk = PublicKey(server_pk) else: raise TypeError("Invalid public key type")