def test_sign_with_unicode_csr(self, mock_six, mock_load_pem): ca_key = self._generate_private_key() private_key = self._generate_private_key() csr_obj = self._build_csr(private_key) csr = csr_obj.public_bytes(serialization.Encoding.PEM) csr = six.u(csr) mock_load_pem.return_value = csr_obj operations.sign(csr, self.issuer_name, ca_key, skip_validation=True) mock_six.assert_called_once_with(csr)
def sign_node_certificate(bay, csr): ca_cert = cert_manager.get_backend().CertManager.get_cert( bay.ca_cert_ref, resource_ref=bay.uuid) node_cert = x509.sign(csr, bay.name, ca_cert.get_private_key(), ca_cert.get_private_key_passphrase()) return node_cert
def sign_node_certificate(bay, csr): ca_cert = cert_manager.get_backend().CertManager.get_cert( bay.ca_cert_ref, resource_ref=bay.uuid ) node_cert = x509.sign(csr, bay.name, ca_cert.get_private_key(), ca_cert.get_private_key_passphrase()) return node_cert
def sign_node_certificate(cluster, csr, context=None): ca_cert = cert_manager.get_backend().CertManager.get_cert( cluster.ca_cert_ref, resource_ref=cluster.uuid, context=context ) node_cert = x509.sign(csr, _get_issuer_name(cluster), ca_cert.get_private_key(), ca_cert.get_private_key_passphrase()) return node_cert
def test_sign_empty_chars(self, mock_load_pem): ca_key = self._generate_private_key() private_key = self._generate_private_key() csr_obj = self._build_csr(private_key) csr = csr_obj.public_bytes(serialization.Encoding.PEM) csr = six.text_type(csr.decode('utf-8')) mock_load_pem.return_value = csr_obj certificate = operations.sign(csr, self.issuer_name, ca_key, skip_validation=True) # Certificate has to be striped for some parsers self.assertEqual(certificate, certificate.strip())
def sign_node_certificate(cluster, csr, ca_cert_type=None, context=None): ref = cluster.ca_cert_ref if ca_cert_type == "etcd": ref = cluster.etcd_ca_cert_ref elif ca_cert_type in ["front_proxy", "front-proxy"]: ref = cluster.front_proxy_ca_cert_ref ca_cert = cert_manager.get_backend().CertManager.get_cert( ref, resource_ref=cluster.uuid, context=context) node_cert = x509.sign(csr, _get_issuer_name(cluster), ca_cert.get_private_key(), ca_cert.get_private_key_passphrase()) return node_cert