An asn1crypto.x509.Certificate or oscrypto.asymmetric.Certificate object
        of the certificate the response is about.
352135
def certificate(self, value):
        

        if value is not None:
            is_oscrypto = isinstance(value, asymmetric.Certificate)
            if not is_oscrypto and not isinstance(value, x509.Certificate):
                raise TypeError(_pretty_message(
                    '''
                    certificate must be an instance of asn1crypto.x509.Certificate
                    or oscrypto.asymmetric.Certificate, not %s
                    ''',
                    _type_name(value)
                ))

            if is_oscrypto:
                value = value.asn1

        self._certificate = value
1089637
def cert
      @cert ||= OpenSSL::X509::Certificate.new.tap do |c|
        c.subject = c.issuer = OpenSSL::X509::Name.parse(cert_subject)
        c.not_before = Time.now
        c.not_after = Time.now + 365 * 24 * 60 * 60
        c.public_key = cert_key
        c.serial = 0x1
        c.version = 0x0
        c.sign cert_key, ::U2F::DIGEST.new
      end
    end
1471
def certificate_rabbitmq(self):
        
        if not self.__certificate_rabbitmq:
            self.__certificate_rabbitmq = CertificateRabbitMQ(self.__connection)
        return self.__certificate_rabbitmq
1056943
def verify_cert(self):
        '''
        
        '''
        log.debug('Verifying the %s certificate, keyfile: %s',
                  self.certificate, self.keyfile)
        try:
            ssl.create_default_context().load_cert_chain(self.certificate, keyfile=self.keyfile)
        except ssl.SSLError:
            error_string = 'SSL certificate and key do not match'
            log.error(error_string)
            raise SSLMismatchException(error_string)
        except IOError:
            log.error('Unable to open either certificate or key file')
            raise
        log.debug('Certificate looks good.')
674843
function forgeObjectFromPem(input) {
    const msg = forge.pem.decode(input)[0];
    let key;

    switch (msg.type) {
        case 'PRIVATE KEY':
        case 'RSA PRIVATE KEY':
            key = forge.pki.privateKeyFromPem(input);
            break;

        case 'PUBLIC KEY':
        case 'RSA PUBLIC KEY':
            key = forge.pki.publicKeyFromPem(input);
            break;

        case 'CERTIFICATE':
        case 'X509 CERTIFICATE':
        case 'TRUSTED CERTIFICATE':
            key = forge.pki.certificateFromPem(input).publicKey;
            break;

        case 'CERTIFICATE REQUEST':
            key = forge.pki.certificationRequestFromPem(input).publicKey;
            break;

        default:
            throw new Error('Unable to detect forge message type');
    }

    return key;
}
1049867
private boolean verifySignature(X509Certificate cert)
        throws CertPathValidatorException {

        try {
            Signature respSignature = Signature.getInstance(sigAlgId.getName());
            respSignature.initVerify(cert.getPublicKey());
            respSignature.update(tbsResponseData);

            if (respSignature.verify(signature)) {
                if (debug != null) {
                    debug.println("Verified signature of OCSP Response");
                }
                return true;

            } else {
                if (debug != null) {
                    debug.println(
                        "Error verifying signature of OCSP Response");
                }
                return false;
            }
        } catch (InvalidKeyException | NoSuchAlgorithmException |
                 SignatureException e)
        {
            throw new CertPathValidatorException(e);
        }
    }
449108
def der_cert(der_data):
    
    if isinstance(der_data, str):
        der_data = bytes(der_data, 'utf-8')
    return x509.load_der_x509_certificate(der_data, default_backend())
614357
def _verify_sig(self, m, cert):
        
        if self.sig_val:
            if self.sig_alg:
                h, sig = _tls_hash_sig[self.sig_alg].split('+')
                if sig.endswith('pss'):
                    t = "pss"
                else:
                    t = "pkcs"
                return cert.verify(m, self.sig_val, t=t, h=h)
            else:
                if self.tls_session.tls_version >= 0x0300:
                    return cert.verify(m, self.sig_val, t='pkcs', h='md5-sha1')
                else:
                    return cert.verify(m, self.sig_val, t='pkcs', h='md5')
        return False
1190064
static public X509Certificate duplicate( X509Certificate cert )
    {
        //log.info( "Duplicating cert={}.", cert );

        X500Principal prince = cert.getSubjectX500Principal();

        log.info( "Principal={}.", prince.getName() );

        KeyPairGenerator kpg;
        try
        {
            kpg = KeyPairGenerator.getInstance( "RSA" );
        }
        catch ( NoSuchAlgorithmException e1 )
        {
            // TODO Auto-generated catch block
            throw new UnsupportedOperationException( "OGTE TODO!", e1 );
        }

        KeyPair keyPair = kpg.generateKeyPair();

        AlgorithmId alg;
        try
        {
            alg = new AlgorithmId( new ObjectIdentifier( cert.getSigAlgOID() ) );
        }
        catch ( IOException e1 )
        {
            // TODO Auto-generated catch block
            throw new UnsupportedOperationException( "OGTE TODO!", e1 );
        }

        X509CertInfo info = new X509CertInfo();
        try
        {
            info.set( X509CertInfo.SUBJECT, new CertificateSubjectName( new X500Name( prince.getName() ) ) );
            info.set( X509CertInfo.KEY, new CertificateX509Key( keyPair.getPublic() ) );
            info.set( X509CertInfo.VALIDITY, new CertificateValidity( cert.getNotBefore(), cert.getNotAfter() ) );
            info.set( X509CertInfo.ISSUER, new CertificateIssuerName( new X500Name( prince.getName() ) ) );

            info.set( X509CertInfo.ALGORITHM_ID, new CertificateAlgorithmId(
                    alg ) );
            info.set( X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber( cert.getSerialNumber() ) );

            info.set( X509CertInfo.VERSION, new CertificateVersion( cert.getVersion() - 1 ) );
            //info.set( x509CertInfo.EXTENSIONS, cert.get)
        }
        catch ( CertificateException | IOException e )
        {
            // TODO Auto-generated catch block
            throw new UnsupportedOperationException( "OGTE TODO!", e );
        }

        log.info( "Cert info={}.", info );

        X509CertImpl newCert = new X509CertImpl( info );

        try
        {
            newCert.sign( keyPair.getPrivate(), alg.getName() );
        }
        catch ( InvalidKeyException | CertificateException | NoSuchAlgorithmException
                | NoSuchProviderException | SignatureException e )
        {
            // TODO Auto-generated catch block
            throw new UnsupportedOperationException( "OGTE TODO!", e );
        }

        log.info( "Returning new cert={}.", newCert );

        return newCert;
    }
370505
def verifyCert(self, cert):
        
        tbsCert = cert.tbsCertificate
        sigAlg = tbsCert.signature
        h = hash_by_oid[sigAlg.algorithm.val]
        sigVal = raw(cert.signatureValue)
        return self.verify(raw(tbsCert), sigVal, h=h, t='pkcs')
589976
OpenSslKeyMaterial chooseKeyMaterial(ByteBufAllocator allocator, String alias) throws Exception {
        X509Certificate[] certificates = keyManager.getCertificateChain(alias);
        if (certificates == null || certificates.length == 0) {
            return null;
        }

        PrivateKey key = keyManager.getPrivateKey(alias);
        PemEncoded encoded = PemX509Certificate.toPEM(allocator, true, certificates);
        long chainBio = 0;
        long pkeyBio = 0;
        long chain = 0;
        long pkey = 0;
        try {
            chainBio = toBIO(allocator, encoded.retain());
            chain = SSL.parseX509Chain(chainBio);

            OpenSslKeyMaterial keyMaterial;
            if (key instanceof OpenSslPrivateKey) {
                keyMaterial = ((OpenSslPrivateKey) key).newKeyMaterial(chain, certificates);
            } else {
                pkeyBio = toBIO(allocator, key);
                pkey = key == null ? 0 : SSL.parsePrivateKey(pkeyBio, password);
                keyMaterial = new DefaultOpenSslKeyMaterial(chain, pkey, certificates);
            }

            // See the chain and pkey to 0 so we will not release it as the ownership was
            // transferred to OpenSslKeyMaterial.
            chain = 0;
            pkey = 0;
            return keyMaterial;
        } finally {
            SSL.freeBIO(chainBio);
            SSL.freeBIO(pkeyBio);
            if (chain != 0) {
                SSL.freeX509Chain(chain);
            }
            if (pkey != 0) {
                SSL.freePrivateKey(pkey);
            }
            encoded.release();
        }
    }
1027677
function x509CertificateChain() {
	var self = {
		__TYPE__ : CertificateType.CERT_CHAIN_VERSION_2,
		NumCertBlobs : new type.UInt32Le(),
        CertBlobArray : new type.Factory(function(s) {
        	self.CertBlobArray = new type.Component([]);
        	for(var i = 0; i < self.NumCertBlobs.value; i++) {
        		self.CertBlobArray.obj.push(certBlob().read(s));
        	}
        }),
        padding : new type.BinaryString(null, { readLength : new type.CallableValue(function() {
        	return 8 + 4 * self.NumCertBlobs.value;
        }) }),
        /**
         * @return {object} {n : modulus{bignum}, e : publicexponent{integer}
         */
        getPublicKey : function(){
        	var cert = x509.X509Certificate().decode(new type.Stream(self.CertBlobArray.obj[self.CertBlobArray.obj.length - 1].obj.abCert.value), asn1.ber);
        	var publikeyStream = new type.Stream(cert.value.tbsCertificate.value.subjectPublicKeyInfo.value.subjectPublicKey.toBuffer());
        	var asn1PublicKey = x509.RSAPublicKey().decode(publikeyStream, asn1.ber);
        	return rsa.publicKey(asn1PublicKey.value.modulus.value, asn1PublicKey.value.publicExponent.value);
        }
	};
	
	return new type.Component(self);
}
994079
public static String getIssuedTo(final X509Certificate certificate)
	{
		final X500Principal issuedToPrincipal = certificate.getIssuerX500Principal();
		final String issuedTo = issuedToPrincipal.getName();
		return issuedTo;
	}
234616
function proprietaryCertificate() {
	var self = {
		__TYPE__ : CertificateType.CERT_CHAIN_VERSION_1,
		dwSigAlgId : new type.UInt32Le(0x00000001, { constant : true }),
        dwKeyAlgId : new type.UInt32Le(0x00000001, { constant : true }),
        wPublicKeyBlobType : new type.UInt16Le(0x0006, { constant : true }),
        wPublicKeyBlobLen : new type.UInt16Le(function() {
        	return self.PublicKeyBlob.size();
        }),
        PublicKeyBlob : rsaPublicKey({ readLength : new type.CallableValue(function() {
        	return self.wPublicKeyBlobLen.value;
        }) }),
        wSignatureBlobType : new type.UInt16Le(0x0008, { constant : true }),
        wSignatureBlobLen : new type.UInt16Le(function() {
        	return self.SignatureBlob.size() + self.padding.size();
        }),
        SignatureBlob : new type.BinaryString(null, { readLength : new type.CallableValue(function() {
        	return self.wSignatureBlobLen.value - self.padding.size;
        }) }),
        padding : new type.BinaryString(Array(8 + 1).join('\x00'), { readLength : new type.CallableValue(8) }),
        /**
         * @return {object} rsa.publicKey
         */
        getPublicKey : function() {
        	return rsa.publicKey(self.PublicKeyBlob.obj.modulus.value, self.PublicKeyBlob.obj.pubExp.value);
        }
	};
	
	return new type.Component(self);
}
1175085
private Collection<? extends java.security.cert.Certificate>
        parseX509orPKCS7Cert(InputStream is)
        throws CertificateException, IOException
    {
        Collection<X509CertImpl> coll = new ArrayList<>();
        byte[] data = readOneBlock(is);
        if (data == null) {
            return new ArrayList<>(0);
        }
        try {
            PKCS7 pkcs7 = new PKCS7(data);
            X509Certificate[] certs = pkcs7.getCertificates();
            // certs are optional in PKCS #7
            if (certs != null) {
                return Arrays.asList(certs);
            } else {
                // no crls provided
                return new ArrayList<>(0);
            }
        } catch (ParsingException e) {
            while (data != null) {
                coll.add(new X509CertImpl(data));
                data = readOneBlock(is);
            }
        }
        return coll;
    }
202096
def get(self, bits=2048, type=crypto.TYPE_RSA, digest='sha1'):
        
        self.log.debug('Creating a new self-signed SSL certificate')
        # Generate the key and ready our cert
        key = crypto.PKey()
        key.generate_key(type, bits)
        cert = crypto.X509()

        # Fill in some pseudo certificate information with a wildcard common name
        cert.get_subject().C  = 'US'
        cert.get_subject().ST = 'California'
        cert.get_subject().L  = 'Los Angeles'
        cert.get_subject().O  = 'Wright Anything Agency'
        cert.get_subject().OU = 'Law firm / talent agency'
        cert.get_subject().CN = '*.{dn}'.format(dn=self.site.domain.name)

        # Set the serial number, expiration and issued
        cert.set_serial_number(1000)
        cert.gmtime_adj_notBefore(0)
        cert.gmtime_adj_notAfter(315360000)
        cert.set_issuer(cert.get_subject())

        # Map the key and sign our certificate
        cert.set_pubkey(key)
        cert.sign(key, digest)

        # Dump the PEM data and return a certificate container
        _cert = crypto.dump_certificate(crypto.FILETYPE_PEM, cert)
        _key  = crypto.dump_privatekey(crypto.FILETYPE_PEM, key)

        return Certificate(_cert, _key, type, bits, digest)
998994
function (obj) {
        return Boolean(obj) && ((obj instanceof Certificate) ||
            _.inSuperChain(obj.constructor, '_postman_propertyName', Certificate._postman_propertyName));
    }