Package org.bouncycastle.x509

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


    v3CertGen.addExtension(
        X509Extensions.AuthorityKeyIdentifier,
        false,
        new AuthorityKeyIdentifierStructure(caCert.getPublicKey()));

    X509Certificate cert = v3CertGen.generate(caPrivateKey, "BC");

    // For debugging purposes.
    //cert.checkValidity(new Date());
    //cert.verify(caCert.getPublicKey());
View Full Code Here


    // Add key usage (usage of the certificate)
    certGen.addExtension(X509Extensions.KeyUsage, true, new KeyUsage(KeyUsage.digitalSignature | KeyUsage.dataEncipherment));

    // Generate certificate and sign it with the ROOT certificate private
    // key...
    return certGen.generate(rootCertificateInfo.getRootCertificatePrivateKey(), PROVIDER);

  }

  /**
   * Method to generate a NORMALIZE certificate
View Full Code Here

    // Add key usage (usage of the certificate)
    certGen.addExtension(X509Extensions.KeyUsage, true, new KeyUsage(KeyUsage.digitalSignature | KeyUsage.dataEncipherment));

    // Generate certificate and sign it with the ROOT certificate private
    // key...
    X509Certificate cert = certGen.generate(rootCertificateInfo.getRootCertificatePrivateKey(), PROVIDER);
    // Return a VO containing the normal certificate and is private key
    return new CertificateVO(cert, keyPair.getPrivate());

  }
View Full Code Here

    certGenerator.setNotBefore(validityBeginDate);
    certGenerator.setNotAfter(validityExpireDate);
    certGenerator.setPublicKey(keyPair.getPublic());
    certGenerator.setSignatureAlgorithm("SHA256WithRSAEncryption");
   
    certificate = certGenerator.generate(keyPair.getPrivate(), "BC");
   
    File file = new File(System.getProperty("catalina.home") + "\\logs\\Certificate_"+transID+".cert");
    FileOutputStream fos = new FileOutputStream(file)
      fos.write(certificate.getEncoded());
      fos.close();    
View Full Code Here

    certGenerator.setNotBefore(validityBeginDate);
    certGenerator.setNotAfter(validityExpireDate);
    certGenerator.setPublicKey(keyPair.getPublic());
    certGenerator.setSignatureAlgorithm("SHA256WithRSAEncryption");
   
    certificate = certGenerator.generate(keyPair.getPrivate(), "BC");
   
    File file = new File(System.getProperty("catalina.home") + "\\logs\\UserCertificate"+username+".cert");
    FileOutputStream fos = new FileOutputStream(file)
      fos.write(certificate.getEncoded());
      fos.close();    
View Full Code Here

//        false,
//        new CRLDistPoint(new DistributionPoint[] {}));



    X509Certificate cert = v3CertGen.generate(caPrivateKey, "BC");

    return cert;
  }

  /**
 
View Full Code Here

    v3CertGen.addExtension(
        X509Extensions.AuthorityKeyIdentifier,
        false,
        new AuthorityKeyIdentifierStructure(caCert.getPublicKey()));

    X509Certificate cert = v3CertGen.generate(caPrivateKey, "BC");

    // For debugging purposes.
    //cert.checkValidity(new Date());
    //cert.verify(caCert.getPublicKey());
View Full Code Here

    v3CertGen.addExtension(
        X509Extensions.ExtendedKeyUsage,
        false,
        new DERSequence(typicalCAExtendedKeyUsages));

    X509Certificate cert = v3CertGen.generate(keyPair.getPrivate(), "BC");

    cert.checkValidity(new Date());

    cert.verify(keyPair.getPublic());
View Full Code Here

        gen.setSubjectDN(principal);
        gen.setIssuerDN(principal);
        gen.setPublicKey(KP.getPublic());
        gen.setSignatureAlgorithm("SHA1WITHRSA");
        try {
            return gen.generate(KP.getPrivate());
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

                    new DEROctetString(value));
            }
        }

        // Generate the certificate
        return certGen.generate(reader.getCaKey());
    }

    @Override
    public X509CRL createX509CRL(List<X509CRLEntryWrapper> entries, BigInteger crlNumber) {
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.