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

    :param str filepath: destination to save certificate. This will overwrite
        any file that is currently at the location.
    :param str name: domain to validate
    :param str dvsni_r: jose base64 encoded dvsni r value
    :param str nonce: hex value of nonce

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

    :returns: dvsni s value jose base64 encoded
    :rtype: str

    """
    # Generate S
    dvsni_s = Random.get_random_bytes(CONFIG.S_SIZE)
    dvsni_r = le_util.jose_b64decode(r_b64)

    # Generate extension
    ext = _dvsni_gen_ext(dvsni_r, dvsni_s)

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

    with open(filepath, 'w') as chall_cert_file:
            chall_cert_file.write(cert_pem)

    return le_util.jose_b64encode(dvsni_s)
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)
Beispiel #3
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)
def dvsni_gen_cert(filepath, name, r_b64, nonce, key):
    """Generate a DVSNI cert and save it to filepath.

    :param str filepath: destination to save certificate. This will overwrite
        any file that is currently at the location.
    :param str name: domain to validate
    :param str dvsni_r: jose base64 encoded dvsni r value
    :param str nonce: hex value of nonce

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

    :returns: dvsni s value jose base64 encoded
    :rtype: str

    """
    # Generate S
    dvsni_s = Random.get_random_bytes(CONFIG.S_SIZE)
    dvsni_r = le_util.jose_b64decode(r_b64)

    # Generate extension
    ext = _dvsni_gen_ext(dvsni_r, dvsni_s)

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

    with open(filepath, 'w') as chall_cert_file:
        chall_cert_file.write(cert_pem)

    return le_util.jose_b64encode(dvsni_s)
    def gen_cert_and_response(self, s=None):  # pylint: disable=invalid-name
        """Generate a DVSNI cert and save it to filepath.

        :returns: ``(cert_pem, response)`` tuple,  where ``cert_pem`` is the PEM
            encoded  certificate and ``response`` is an instance
            :class:`letsencrypt.acme.challenges.DVSNIResponse`.
        :rtype: tuple

        """
        response = challenges.DVSNIResponse(s=s)
        cert_pem = crypto_util.make_ss_cert(self.key.pem, [
            self.nonce_domain, self.domain, response.z_domain(self.challb)])
        return cert_pem, response
    def createChallengeCert(self, name, ext, nonce, key):
        """
        Modifies challenge certificate configuration and calls openssl binary to create a certificate

        ext:    string - hex z value
        nonce:  string - hex
        key:    string - file path to key

        result: certificate created at getDvsniCertFile(nonce)
        """
        #self.createCHOC_CERT_CONF(name, ext)

        self.configurator.register_file_creation(True, self.getDvsniCertFile(nonce))
        cert_pem = crypto_util.make_ss_cert(key, [nonce + INVALID_EXT, name, ext])
        with open(self.getDvsniCertFile(nonce), 'w') as f:
            f.write(cert_pem)
 def test_it(self):  # pylint: disable=no-self-use
     from letsencrypt.client.crypto_util import make_ss_cert
     make_ss_cert(RSA256_KEY, ['example.com', 'www.example.com'])
 def test_it(self):
     from letsencrypt.client.crypto_util import make_ss_cert
     make_ss_cert(RSA256_KEY, ['example.com', 'www.example.com'])
Beispiel #9
0
 def test_it(self):  # pylint: disable=no-self-use
     from letsencrypt.client.crypto_util import make_ss_cert
     make_ss_cert(RSA256_KEY, ['example.com', 'www.example.com'])
 def test_it(self):
     from letsencrypt.client.crypto_util import make_ss_cert
     make_ss_cert(RSA256_KEY, ['example.com', 'www.example.com'])