async def revoke(self, certificate):
        """
        Revoke certificate's public key into REMChain.
        Send transaction to chain.

        Args:
            certificate (object): certificate object

        Returns:
            Information about public key.

        To use:
            .. code-block:: python

                remme = Remme()
                revoke_response = remme.certificate.revoke(certificate)
        """
        if type(certificate) == str:
            certificate = certificate_from_pem(certificate=certificate)

        address = RSA.get_address_from_public_key(
            public_key_to_der(public_key=certificate.public_key()), )

        return await self._remme_public_key_storage.revoke(
            public_key_address=address)
    async def get_info(self, certificate):
        """
        Get info about certificate's public key.

        Args:
            certificate (object): certificate object

        Returns:
            Information about public key.

        To use:
            .. code-block:: python

                remme = Remme()
                info = remme.certificate.get_info(certificate)
        """
        if type(certificate) == str:
            certificate = certificate_from_pem(certificate=certificate)

        address = RSA.get_address_from_public_key(
            public_key_to_der(public_key=certificate.public_key()), )

        check_result = await self._remme_public_key_storage.get_info(
            public_key_address=address)

        if check_result is not None:
            return check_result
        else:
            raise Exception('This certificate was not found.')
    async def check(self, certificate):
        """
        Check certificate's public key on validity and revocation.

        Args:
            certificate (object): certificate object

        Returns:
            Boolean ``True``.

        To use:
            .. code-block:: python

                remme = Remme()
                is_valid = remme.certificate.check(certificate)
        """
        if type(certificate) == str:
            certificate = certificate_from_pem(certificate=certificate)

        address = RSA.get_address_from_public_key(
            public_key_to_der(public_key=certificate.public_key()), )

        check_result = await self._remme_public_key_storage.check(
            address=address)

        if check_result:
            return check_result
        else:
            raise Exception('This certificate was not found.')
    async def store(self, certificate):
        """
        Store your certificate public key and hash of certificate into REMChain.
        Your certificate should contains private and public keys.
        Send transaction to chain.

        Args:
            certificate (object): certificate object

        Returns:
            Information about storing public key to REMChain.

        To use:
            .. code-block:: python

                remme = Remme()
                certificate = remme.certificate.create(
                    common_name='user_name',
                    email='*****@*****.**',
                    name='John',
                    surname='Smith',
                    country_name='US',
                    validity=360,
                    serial=str(datetime.now())
                )
                store_response = remme.certificate.store(certificate)
        """
        if type(certificate) == str:
            certificate = certificate_from_pem(certificate=certificate)

        certificate_pem = certificate_to_pem(
            certificate=certificate).decode('utf-8')

        valid_from = math.floor(
            int(certificate.not_valid_before.strftime("%s")) / 1000)
        valid_to = math.floor(
            int(certificate.not_valid_after.strftime("%s")) / 1000)

        batch_response = await self._remme_public_key_storage.create_and_store(
            data=certificate_pem,
            keys=RSA(
                private_key=private_key_to_der(certificate.private_key),
                public_key=public_key_to_der(certificate.public_key()),
            ),
            rsa_signature_padding=RsaSignaturePadding.PSS,
            valid_from=valid_from,
            valid_to=valid_to,
            do_owner_pay=False,
        )

        return CertificateTransactionResponse(
            network_config=batch_response.network_config,
            batch_id=batch_response.batch_id,
            certificate=certificate,
        )
    def sign(self, certificate, data, rsa_signature_padding=None):
        """
        Sign data with a certificate's private key and output DigestInfo DER-encoded bytes (default for PSS).

        Args:
            certificate (object): certificate object
            data (string): data string which will be signed
            rsa_signature_padding (RsaSignaturePadding): RSA padding

        Returns:
            Hex string of signature.
        """
        if type(certificate) == str:
            certificate = certificate_from_pem(certificate=certificate)

        if certificate.private_key is None:
            raise Exception('Your certificate does not have private key.')

        keys = RSA(private_key=private_key_to_der(certificate.private_key))

        return keys.sign(data=data,
                         rsa_signature_padding=rsa_signature_padding)
    def verify(self, certificate, data, signature, rsa_signature_padding=None):
        """
        Verify data with a public key (default for PSS).

        Args:
            certificate (object): certificate object
            data (string): data string which will be verified
            signature (string): hex string of signature
            rsa_signature_padding (RsaSignaturePadding): RSA padding

        Returns:
            Boolean ``True`` if signature is correct, or ``False`` if invalid.
        """
        if type(certificate) == str:
            certificate = certificate_from_pem(certificate=certificate)

        if certificate.private_key is None:
            raise Exception('Your certificate does not have private key.')

        keys = RSA(public_key=public_key_to_der(certificate.public_key()))

        return keys.verify(data=data,
                           signature=signature,
                           rsa_signature_padding=rsa_signature_padding)