How to use the josepy.JWKRSA.json_loads function in josepy

To help you get started, we’ve selected a few josepy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zenhack / simp_le / View on Github external
def load_jwk(cls, data):
        """Load JWK."""
        return jose.JWKRSA.json_loads(data)
github aptise / peter_sslers / peter_sslers / lib / View on Github external
def convert_lejson_to_pem(pkey_jsons):
    This routine will use crypto/certbot if available.
    If not, openssl is used via subprocesses

    input is a json string
    much work from

    openssl asn1parse -noout -out private_key.der -genconf <(python private_key.json)
    openssl rsa -in private_key.der -inform der > private_key.pem
    openssl rsa -in private_key.pem
    """"convert_lejson_to_pem >")

    if cryptography_serialization:
        pkey = josepy.JWKRSA.json_loads(pkey_jsons)
        as_pem = pkey.key.private_bytes(
        if six.PY3:
            as_pem = as_pem.decode()
        as_pem = cleanup_pem_text(as_pem)

        # note: we don't need to provide key_pem_filepath before we won't rely on openssl
        return as_pem

    log.debug(".convert_lejson_to_pem > openssl fallback")
    pkey_ans1 = convert_jwk_to_ans1(pkey_jsons)
    as_pem = None