Examples of copyAndAddExtension()


Examples of org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder.copyAndAddExtension()

            JcaX509ExtensionUtils jxeu = new JcaX509ExtensionUtils();

            if (baseCrt != null) {
                byte[] sans = baseCrt.getExtensionValue(X509Extension.subjectAlternativeName.getId());
                if (sans != null) {
                    certificateBuilder.copyAndAddExtension(X509Extension.subjectAlternativeName, true, baseCrt);
                }
            }

            SubjectKeyIdentifier subjectKeyIdentifier = jxeu.createSubjectKeyIdentifier(pubKey);
            certificateBuilder.addExtension(
View Full Code Here

Examples of org.bouncycastle.x509.X509V3CertificateGenerator.copyAndAddExtension()

        certGen.setNotAfter(new Date(System.currentTimeMillis() + 50000));
        certGen.setSubjectDN(new X509Principal(ord, values));
        certGen.setPublicKey(pubKey);
        certGen.setSignatureAlgorithm("MD5WithRSAEncryption");

        certGen.copyAndAddExtension(new DERObjectIdentifier("2.5.29.15"), true, baseCert);
        certGen.copyAndAddExtension("2.5.29.37", false, baseCert);
       
        X509Certificate cert = certGen.generate(privKey, "BC");
       
        cert.checkValidity(new Date());
View Full Code Here

Examples of org.bouncycastle.x509.X509V3CertificateGenerator.copyAndAddExtension()

        certGen.setSubjectDN(new X509Principal(ord, values));
        certGen.setPublicKey(pubKey);
        certGen.setSignatureAlgorithm("MD5WithRSAEncryption");

        certGen.copyAndAddExtension(new DERObjectIdentifier("2.5.29.15"), true, baseCert);
        certGen.copyAndAddExtension("2.5.29.37", false, baseCert);
       
        X509Certificate cert = certGen.generate(privKey, "BC");
       
        cert.checkValidity(new Date());
   
View Full Code Here

Examples of org.bouncycastle.x509.X509V3CertificateGenerator.copyAndAddExtension()

        //
        // exception test
        //
        try
        {
            certGen.copyAndAddExtension("2.5.99.99", true, baseCert);
           
            fail("exception not thrown on dud extension copy");
        }
        catch (CertificateParsingException e)
        {
View Full Code Here

Examples of org.bouncycastle.x509.X509V3CertificateGenerator.copyAndAddExtension()

        certGen.setNotAfter(new Date(System.currentTimeMillis() + 50000));
        certGen.setSubjectDN(new X509Principal(attrs));
        certGen.setPublicKey(pubKey);
        certGen.setSignatureAlgorithm("MD5WithRSAEncryption");

        certGen.copyAndAddExtension(new DERObjectIdentifier("2.5.29.15"), true, baseCert);
        certGen.copyAndAddExtension("2.5.29.37", false, baseCert);
       
        X509Certificate cert = certGen.generate(privKey, "BC");
       
        cert.checkValidity(new Date());
View Full Code Here

Examples of org.bouncycastle.x509.X509V3CertificateGenerator.copyAndAddExtension()

        certGen.setSubjectDN(new X509Principal(attrs));
        certGen.setPublicKey(pubKey);
        certGen.setSignatureAlgorithm("MD5WithRSAEncryption");

        certGen.copyAndAddExtension(new DERObjectIdentifier("2.5.29.15"), true, baseCert);
        certGen.copyAndAddExtension("2.5.29.37", false, baseCert);
       
        X509Certificate cert = certGen.generate(privKey, "BC");
       
        cert.checkValidity(new Date());
   
View Full Code Here

Examples of org.bouncycastle.x509.X509V3CertificateGenerator.copyAndAddExtension()

        //
        // exception test
        //
        try
        {
            certGen.copyAndAddExtension("2.5.99.99", true, baseCert);
           
            fail("exception not thrown on dud extension copy");
        }
        catch (CertificateParsingException e)
        {
View Full Code Here

Examples of org.bouncycastle.x509.X509V3CertificateGenerator.copyAndAddExtension()

    if(critExts != null) {
      for (String oid : critExts) {
        if(!clientCertOidsNeverToCopy.contains(oid)
            && !extensionOidsNotToCopy.contains(oid)
            && !criticalCustomExtensions.containsKey(oid)) {
          v3CertGen.copyAndAddExtension(new DERObjectIdentifier(oid), true, originalCert);
        }
      }
    }
    Set<String> nonCritExs = originalCert.getNonCriticalExtensionOIDs();
View Full Code Here

Examples of org.bouncycastle.x509.X509V3CertificateGenerator.copyAndAddExtension()

      for(String oid: nonCritExs) {

        if(!clientCertOidsNeverToCopy.contains(oid)
            && !extensionOidsNotToCopy.contains(oid)
            && !noncriticalCustomExtensions.containsKey(oid)){
          v3CertGen.copyAndAddExtension(new DERObjectIdentifier(oid), false, originalCert);
        }
      }
    }

    for(Map.Entry<String, DEREncodable> customExtension: criticalCustomExtensions.entrySet()) {
View Full Code Here

Examples of org.bouncycastle.x509.X509V3CertificateGenerator.copyAndAddExtension()

        certGen.setNotAfter(new Date(System.currentTimeMillis() + 50000));
        certGen.setSubjectDN(new X509Principal(attrs));
        certGen.setPublicKey(pubKey);
        certGen.setSignatureAlgorithm("MD5WithRSAEncryption");

        certGen.copyAndAddExtension(new DERObjectIdentifier("2.5.29.15"), true, baseCert);
        certGen.copyAndAddExtension("2.5.29.37", false, baseCert);
       
        X509Certificate cert = certGen.generateX509Certificate(privKey);
       
        cert.checkValidity(new Date());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.