Package org.bouncycastle.x509

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


        certGen.setPublicKey( publicKey );
        certGen.setSignatureAlgorithm( "SHA1With" + keyAlgo );

        try
        {
            X509Certificate cert = certGen.generate( privateKey, "BC" );
            entry.put( USER_CERTIFICATE_AT, cert.getEncoded() );
            LOG.debug( "X509 Certificate: {}", cert );
        }
        catch ( Exception e )
        {
View Full Code Here


    certGen.setSubjectDN(new X500Principal("CN=Test Root Certificate subject DN"));
    certGen.setPublicKey(keyPair.getPublic());
    certGen.setSignatureAlgorithm(SIGNATURE_ALGORITHM);

    // Generate certificate...
    return new RootCertificateVO(certGen.generate(keyPair.getPrivate(), PROVIDER), keyPair.getPrivate());
  }

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

      certGen.setSubjectDN(new X500Principal("CN=Certificate"));
      certGen.setPublicKey(publicKey);
      certGen.setSignatureAlgorithm("SHA256WithRSAEncryption");

      Certificate[] chain = new Certificate[1];
      chain[0] = certGen.generate(privateKey,"BC");


      // add the key to the keystore
      keyStore.setKeyEntry(keyAlias, privateKey, keyStorePassword.toCharArray(), chain);
View Full Code Here

        certGen.setNotBefore( startDate );
        certGen.setNotAfter( expiryDate );
        certGen.setSubjectDN( subjectName );
        certGen.setPublicKey( publicKey );
        certGen.setSignatureAlgorithm( "SHA1With" + keyAlgo );
        X509Certificate cert = certGen.generate( privateKey, "BC" );

        // Write the modifications
        ModifyRequest request = new ModifyRequestImpl();
        request.setName( dn );
        request.replace( PRIVATE_KEY_AT, privateKey.getEncoded() );
View Full Code Here

        certGen.setPublicKey( publicKey );
        certGen.setSignatureAlgorithm( "SHA1With" + ALGORITHM );

        try
        {
            X509Certificate cert = certGen.generate( privateKey, "BC" );
            entry.put( USER_CERTIFICATE_AT, cert.getEncoded() );
            LOG.debug( "X509 Certificate: {}", cert );
        }
        catch ( Exception e )
        {
View Full Code Here

        certGen.setPublicKey( publicKey );
        certGen.setSignatureAlgorithm( "SHA1With" + keyAlgo );

        try
        {
            X509Certificate cert = certGen.generate( privateKey, "BC" );
            entry.put( USER_CERTIFICATE_AT, cert.getEncoded() );
            LOG.debug( "X509 Certificate: {}", cert );
        }
        catch ( Exception e )
        {
View Full Code Here

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

        cert = certGen1.generate(privKey);

        cert.checkValidity(new Date());

        cert.verify(pubKey);
View Full Code Here

        certGen1.setPublicKey(pubKey);
        certGen1.setSignatureAlgorithm("SHA1withDSA");

        try
        {
            X509Certificate cert = certGen1.generate(privKey);

            cert.checkValidity(new Date());

            cert.verify(pubKey);
View Full Code Here

        calendar.add(Calendar.YEAR, 10);
        certGen.setNotAfter(calendar.getTime());
        certGen.setSubjectDN(subjectPrincipal);
        certGen.setPublicKey(keyPair.getPublic());
        certGen.setSignatureAlgorithm("SHA256WithRSAEncryption");
        X509Certificate cert = certGen.generate(keyPair.getPrivate(), "BC");
        return cert;
    }
}
View Full Code Here

                new DERSequence(roleSyntax));

        acGen.addAttribute(attributes);

        //      finally create the AC
        X509V2AttributeCertificate att = (X509V2AttributeCertificate)acGen
                .generate(caPrivKey, "BC");

        //
        // starting here, we parse the newly generated AC
        //
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.