Best code examples for Java 8 Certificate class (java.security.cert.Certificate)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Certificate class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 Certificate examples from Open Source projects
This code example shows how to use the following methods: getPublicKey, getNotAfter, getNotBefore, getSerialNumber, getSigAlgName
51:	certGenerator.setSerialNumber(certificate.getSerialNumber()); 
52:	certGenerator.setPublicKey(certificate.getPublicKey()); 
53:	certGenerator.setSubjectDN(certificate.getSubjectX500Principal()); 
-
55:	certGenerator.setNotBefore(certificate.getNotBefore()); 
56:	certGenerator.setNotAfter(certificate.getNotAfter()); 
57:	certGenerator.setSignatureAlgorithm(certificate.getSigAlgName()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPublicKey, getSigAlgName, getSignature, getTBSCertificate
97:	byte[]           tbs = cert.getTBSCertificate(); 
98:	Signature        sig = Signature.getInstance(cert.getSigAlgName(), "BC"); 
-
100:	sig.initVerify(cert.getPublicKey()); 
-
104:	assertFalse(sig.verify(cert.getSignature())); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getEncoded, getType
341:	byte[]      cEnc = cert.getEncoded(); 
-
343:	dOut.writeUTF(cert.getType()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEncoded, getIssuerDN, getIssuerX500Principal, getSerialNumber
247:	issuerName = certificate.getIssuerDN().getName().replace(",", ", "); 
-
249:	issuerName = certificate.getIssuerX500Principal().toString(); 
-
252:	issuerSerial.setX509SerialNumber(certificate.getSerialNumber()); 
-
256:	encodedCertificate = certificate.getEncoded(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getType, getIssuerDN, getNotAfter, getNotBefore, getSubjectDN
39:	System.out.println(" " + alias + " (" + x509.getType() + ")\n" + 
40:	"  valid from " + x509.getNotBefore() + " to " + x509.getNotAfter() + "\n" + 
41:	"  for        " + x509.getSubjectDN().getName() + "\n" + 
42:	"  issued by  " + x509.getIssuerDN().getName()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: verify, getIssuerX500Principal, getSubjectX500Principal
69:	final X509Certificate trustRoot = trustRoots.get(certificate.getIssuerX500Principal()); 
-
75:	if (trustRoot.getSubjectX500Principal().equals(certificate.getSubjectX500Principal())) { 
-
80:	certificate.verify(trustRoot.getPublicKey()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey, getIssuerDN, getNotAfter, getNotBefore, getSerialNumber
215:	certData.setSubjectDN(cert.getSubjectDN().getName()); 
216:	certData.setIssuerDN(cert.getIssuerDN().getName()); 
217:	certData.setSerialNumber(cert.getSerialNumber()); 
218:	certData.setVersion(cert.getVersion()); 
219:	certData.setNotAfter(formatter.format(cert.getNotAfter())); 
220:	certData.setNotBefore(formatter.format(cert.getNotBefore())); 
221:	certData.setPublicKey(Base64.encode(cert.getPublicKey().getEncoded())); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getEncoded, getSerialNumber
25:	Certificate certStruct = Certificate.getInstance(cert.getEncoded()); 
-
27:	return new IssuerAndSerialNumber(certStruct.getIssuer(), cert.getSerialNumber()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getPublicKey, getSigAlgName, getSignature, getTBSCertificate
97:	byte[]           tbs = cert.getTBSCertificate(); 
98:	Signature        sig = Signature.getInstance(cert.getSigAlgName(), "BC"); 
-
100:	sig.initVerify(cert.getPublicKey()); 
-
104:	assertFalse(sig.verify(cert.getSignature())); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEncoded
562:	byte[] b2 = other.getEncoded(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey
138:	aCert.verify(sCert.getPublicKey(), "BC"); 
-
146:	list.add(sCert); 
-
152:	if (certs.size() != 1 || !certs.contains(sCert)) 
-
168:	aCert.verify(sCert.getPublicKey(), "BC"); 
-
227:	if (certs.size() != 1 || !certs.contains(sCert)) 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey, checkValidity
51:	cert.checkValidity(); 
-
55:	return cert.getPublicKey(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEncoded, getType
341:	byte[]      cEnc = cert.getEncoded(); 
-
343:	dOut.writeUTF(cert.getType()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: hashCode
227:	knownServers.setCertificateEntry(Integer.toString(cert.hashCode()), cert); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: verify, getIssuerX500Principal
193:	x509Certificate.getIssuerX500Principal()); 
-
205:	x509Certificate.verify(publicKey); 
-
223:	trustedCertPath.add(x509Certificate); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEncoded
38:	byte[] rawOctets = cert.getEncoded(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey
149:	X509Principal issuerName = PrincipalUtil.getSubjectX509Principal(issuerCert); 
-
154:	PublicKey issuerKey = issuerCert.getPublicKey(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEncoded, getSerialNumber
25:	Certificate certStruct = Certificate.getInstance(cert.getEncoded()); 
-
27:	return new IssuerAndSerialNumber(certStruct.getIssuer(), cert.getSerialNumber()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: verify, getIssuerX500Principal
77:	if (!parent.getSubjectX500Principal().equals(child.getIssuerX500Principal())) { 
-
82:	child.verify(parent.getPublicKey()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey
107:	this(certificate.getPublicKey()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: verify, checkValidity
270:	_cert.checkValidity(new Date()); 
271:	_cert.verify(issPub); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey
94:	recipientIDs.add(new KeyAgreeRecipientIdentifier(CMSUtils.getIssuerAndSerialNumber(recipientCert))); 
95:	recipientKeys.add(recipientCert.getPublicKey()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey, verify
207:	rootCert.verify(rootCert.getPublicKey(), "BC"); 
208:	userCert1.verify(rootCert.getPublicKey(), "BC"); 
-
210:	crl.verify(rootCert.getPublicKey(), "BC"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey
497:	c.verify(ca.getPublicKey()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: verify, checkValidity
273:	_cert.checkValidity(new Date()); 
274:	_cert.verify(issPub); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getEncoded
562:	byte[] b2 = other.getEncoded(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getPublicKey, checkValidity
424:	cert.checkValidity(); 
-
431:	sig.addKeyInfo(cert); 
432:	sig.addKeyInfo(cert.getPublicKey()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey
376:	if (cert.getPublicKey() instanceof DSAPublicKey) 
-
378:	DSAPublicKey key = (DSAPublicKey)cert.getPublicKey(); 
-
386:	assertEquals(true, signer.verify(cert, BC)); 
-
391:	assertEquals(true, signer.verify(cert, BC)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPublicKey
65:	 
-
75:	PublicKey publicKey = cert.getPublicKey(); 
-
78:	LOG.debug("Certificate: {}", cert); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded
345:	os.write(cert.getEncoded()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: verify, getIssuerX500Principal
193:	x509Certificate.getIssuerX500Principal()); 
-
205:	x509Certificate.verify(publicKey); 
-
223:	trustedCertPath.add(x509Certificate); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getPublicKey
21:	super(new IssuerAndSerialNumber(new JcaX509CertificateHolder(recipientCert).toASN1Structure()), new JceAsymmetricKeyWrapper(recipientCert)); 
-
43:	* 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded
378:	return pem(cert.getEncoded(), marker); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: equals, hashCode
80:	assertTrue((c1.hashCode() == c2.hashCode()) && c1.equals(c2)); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded
360:	byte[] buf = signingCert.getEncoded(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded, getType
341:	byte[]      cEnc = cert.getEncoded(); 
-
343:	dOut.writeUTF(cert.getType()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded
This code example shows how to use the following methods: toString, getExtensionValue
73:	byte[] extnValue = pemCert.getExtensionValue("2.5.29.35"); 
-
76:	assertNotNull(pemCert.toString()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getPublicKey
50:	byte[] encoded = cert.getPublicKey().getEncoded(); 
-
66:	shortChain.add(root); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded
24:	return build(new JcaX509CertificateHolder(certificate)); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getPublicKey
43:	this(certificate.getPublicKey()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded
37:	byte[] rawOctets = cert.getEncoded(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded
24:	super(Certificate.getInstance(cert.getEncoded())); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getPublicKey
127:	PublicKey pubKey = signer.getPublicKey(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded
28:	return Certificate.getInstance(certificate.getEncoded()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getPublicKey
94:	recipientIDs.add(new KeyAgreeRecipientIdentifier(CMSUtils.getIssuerAndSerialNumber(recipientCert))); 
95:	recipientKeys.add(recipientCert.getPublicKey()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getEncoded
24:	import org.bouncycastle.x509.X509V2AttributeCertificate; 
Full Snippet Info
5
CodeRank
Related Java 8 Certificate Questions & Answers:
See Code Examples for Java 8 Certificate Methods: