def dvsni_gen_cert(name, r_b64, nonce, key):
    """Generate a DVSNI cert and save it to filepath.

    :param str name: domain to validate
    :param str r_b64: jose base64 encoded dvsni r value
    :param str nonce: hex value of nonce

    :param key: Key to perform challenge
    :type key: :class:`letsencrypt.client.le_util.Key`

    :returns: tuple of (cert_pem, s) where
        cert_pem is the certificate in pem form
        s is the dvsni s value, jose base64 encoded
    :rtype: tuple

    """
    # Generate S
    dvsni_s = Random.get_random_bytes(constants.S_SIZE)
    dvsni_r = jose.b64decode(r_b64)

    # Generate extension
    ext = _dvsni_gen_ext(dvsni_r, dvsni_s)

    cert_pem = crypto_util.make_ss_cert(
        key.pem, [nonce + constants.DVSNI_DOMAIN_SUFFIX, name, ext])

    return cert_pem, jose.b64encode(dvsni_s)
Exemple #2
0
def dvsni_gen_cert(name, r_b64, nonce, key):
    """Generate a DVSNI cert and save it to filepath.

    :param str name: domain to validate
    :param str r_b64: jose base64 encoded dvsni r value
    :param str nonce: hex value of nonce

    :param key: Key to perform challenge
    :type key: :class:`letsencrypt.client.le_util.Key`

    :returns: tuple of (cert_pem, s) where
        cert_pem is the certificate in pem form
        s is the dvsni s value, jose base64 encoded
    :rtype: tuple

    """
    # Generate S
    dvsni_s = Random.get_random_bytes(constants.S_SIZE)
    dvsni_r = jose.b64decode(r_b64)

    # Generate extension
    ext = _dvsni_gen_ext(dvsni_r, dvsni_s)

    cert_pem = crypto_util.make_ss_cert(
        key.pem, [nonce + constants.DVSNI_DOMAIN_SUFFIX, name, ext])

    return cert_pem, jose.b64encode(dvsni_s)
Exemple #3
0
 def _from_valid_json(cls, jobj):
     return cls(session_id=jobj["sessionID"],
                nonce=jose.b64decode(jobj["nonce"]),
                responses=jobj["responses"],
                signature=other.Signature.from_json(jobj["signature"],
                                                    validate=False),
                contact=jobj.get("contact", []))
 def _from_valid_json(cls, jobj):
     return cls(session_id=jobj["sessionID"],
                nonce=jose.b64decode(jobj["nonce"]),
                responses=jobj["responses"],
                signature=other.Signature.from_json(
                    jobj["signature"], validate=False),
                contact=jobj.get("contact", []))
Exemple #5
0
    def test_standard(self):
        """Basic test for straightline code."""
        domain = "example.com"
        dvsni_r = "r_value"
        r_b64 = jose.b64encode(dvsni_r)
        pem = pkg_resources.resource_string(
            __name__, os.path.join("testdata", "rsa256_key.pem"))
        key = le_util.Key("path", pem)
        nonce = "12345ABCDE"
        cert_pem, s_b64 = self._call(domain, r_b64, nonce, key)

        # pylint: disable=protected-access
        ext = challenge_util._dvsni_gen_ext(dvsni_r, jose.b64decode(s_b64))
        self._standard_check_cert(cert_pem, domain, nonce, ext)
    def test_standard(self):
        """Basic test for straightline code."""
        domain = "example.com"
        dvsni_r = "r_value"
        r_b64 = jose.b64encode(dvsni_r)
        pem = pkg_resources.resource_string(
            __name__, os.path.join("testdata", "rsa256_key.pem"))
        key = le_util.Key("path", pem)
        nonce = "12345ABCDE"
        cert_pem, s_b64 = self._call(domain, r_b64, nonce, key)

        # pylint: disable=protected-access
        ext = challenge_util._dvsni_gen_ext(
            dvsni_r, jose.b64decode(s_b64))
        self._standard_check_cert(cert_pem, domain, nonce, ext)
 def _call(cls, data):
     from letsencrypt.acme.jose import b64decode
     return b64decode(data)
 def _call(cls, data):
     from letsencrypt.acme.jose import b64decode
     return b64decode(data)
 def _from_valid_json(cls, jobj):
     return cls(alg=jobj['alg'], sig=jose.b64decode(jobj['sig']),
                nonce=jose.b64decode(jobj['nonce']),
                jwk=jose.JWK.from_json(jobj['jwk'], validate=False))
Exemple #10
0
 def _decode_cert(cls, b64der):
     return util.ComparableX509(
         M2Crypto.X509.load_cert_der_string(jose.b64decode(b64der)))
Exemple #11
0
 def _from_valid_json(cls, jobj):
     return cls(session_id=jobj["sessionID"],
                nonce=jose.b64decode(jobj["nonce"]),
                challenges=jobj["challenges"],
                combinations=jobj.get("combinations", []))
 def _decode_cert(cls, b64der):
     return util.ComparableX509(M2Crypto.X509.load_cert_der_string(
         jose.b64decode(b64der)))
 def _from_valid_json(cls, jobj):
     return cls(session_id=jobj["sessionID"],
                nonce=jose.b64decode(jobj["nonce"]),
                challenges=jobj["challenges"],
                combinations=jobj.get("combinations", []))