org.bouncycastle.asn1.x509.CRLNumber Java Examples
The following examples show how to use
org.bouncycastle.asn1.x509.CRLNumber.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: X509Ext.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
private String getDeltaCrlIndicatorStringValue(byte[] value) throws IOException { // @formatter:off /* * deltaCRLIndicator EXTENSION ::= { SYNTAX BaseCRLNumber IDENTIFIED BY * id-ce-deltaCRLIndicator } * * BaseCRLNumber ::= CRLNumber * * CRLNumber ::= ASN1Integer (0..MAX) */ // @formatter:on CRLNumber crlNumber = CRLNumber.getInstance(value); BigInteger crlNum = crlNumber.getCRLNumber(); return HexUtil.getHexString(crlNum) + NEWLINE; }
Example #2
Source File: X509Ext.java From keystore-explorer with GNU General Public License v3.0 | 5 votes |
private String getCrlNumberStringValue(byte[] value) throws IOException { // @formatter:off /* CRLNumber ::= ASN1Integer (0..MAX) */ // @formatter:on StringBuilder sb = new StringBuilder(); CRLNumber crlNumber = CRLNumber.getInstance(value); sb.append(HexUtil.getHexString(crlNumber.getCRLNumber())); sb.append(NEWLINE); return sb.toString(); }
Example #3
Source File: CrlExtensionsUtils.java From xades4j with GNU Lesser General Public License v3.0 | 5 votes |
public static BigInteger getCrlNumber(X509CRL crl) throws IOException { byte[] crlNumEnc = crl.getExtensionValue(X509Extension.cRLNumber.getId()); BigInteger crlNum = null; // XAdES 7.4.2: "The 'number' element is an optional hint ..." if (crlNumEnc != null) { ASN1Object derCrlNum = X509ExtensionUtil.fromExtensionValue(crlNumEnc); crlNum = CRLNumber.getInstance(derCrlNum).getCRLNumber(); } return crlNum; }
Example #4
Source File: TlsTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private static X509CRLHolder createCRL() throws Exception { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); SelfSignedX509CertificateAndSigningKey muneraSelfSignedX509CertificateAndSigningKey = SelfSignedX509CertificateAndSigningKey.builder() .setDn(MUNERASOFT_DN) .setKeyAlgorithmName("RSA") .setSignatureAlgorithmName("SHA256withRSA") .addExtension(false, "BasicConstraints", "CA:true,pathlen:2147483647") .build(); X509Certificate muneraCertificate = muneraSelfSignedX509CertificateAndSigningKey.getSelfSignedCertificate(); Calendar calendar = Calendar.getInstance(); Date currentDate = calendar.getTime(); calendar.add(Calendar.YEAR, 1); Date nextYear = calendar.getTime(); calendar.add(Calendar.YEAR, -1); calendar.add(Calendar.SECOND, -30); Date revokeDate = calendar.getTime(); X509v2CRLBuilder crlBuilder = new X509v2CRLBuilder( new X500Name(MUNERASOFT_DN.getName()), currentDate ); crlBuilder.addExtension( Extension.authorityKeyIdentifier, false, new JcaX509ExtensionUtils().createAuthorityKeyIdentifier(muneraCertificate.getPublicKey()) ); crlBuilder.addExtension( Extension.cRLNumber, false, new CRLNumber(BigInteger.valueOf(4110)) ); crlBuilder.addCRLEntry( new BigInteger("1005"), revokeDate, CRLReason.unspecified ); crlBuilder.addCRLEntry( new BigInteger("1006"), revokeDate, CRLReason.unspecified ); return crlBuilder.setNextUpdate(nextYear).build( new JcaContentSignerBuilder("SHA256withRSA") .setProvider("BC") .build(muneraSelfSignedX509CertificateAndSigningKey.getSigningKey()) ); }