Package org.bouncycastle.x509

Examples of org.bouncycastle.x509.X509V2AttributeCertificateGenerator.addExtension()


    v3CertGen.setSignatureAlgorithm("SHA1WithRSAEncryption");

    //
    // add the extensions
    //
    v3CertGen.addExtension(X509Extensions.SubjectKeyIdentifier, false,
            new SubjectKeyIdentifierStructure(pubKey));

    v3CertGen.addExtension(X509Extensions.AuthorityKeyIdentifier, false,
            new AuthorityKeyIdentifierStructure(caCert.getPublicKey()));
View Full Code Here


    // add the extensions
    //
    v3CertGen.addExtension(X509Extensions.SubjectKeyIdentifier, false,
            new SubjectKeyIdentifierStructure(pubKey));

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

    v3CertGen.addExtension(X509Extensions.BasicConstraints, true,
            new BasicConstraints(0));
View Full Code Here

            new SubjectKeyIdentifierStructure(pubKey));

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

    v3CertGen.addExtension(X509Extensions.BasicConstraints, true,
            new BasicConstraints(0));

    // X509Certificate cert = v3CertGen.generateX509Certificate(caPrivKey);
    final X509Certificate cert = v3CertGen.generate(caPriKey, "BC");
    cert.checkValidity(new Date());
View Full Code Here

//        }

/*
     Adds the Basic Constraint (CA: false) extension.
*/
    certGenerator.addExtension(X509Extension.basicConstraints, true,
        new BasicConstraints(false));

/*
    Adds the Key Usage extension.
*/
 
View Full Code Here

        new BasicConstraints(false));

/*
    Adds the Key Usage extension.
*/
    certGenerator.addExtension(X509Extension.keyUsage, true, new KeyUsage(
        KeyUsage.digitalSignature | KeyUsage.nonRepudiation
            | KeyUsage.keyEncipherment | KeyUsage.keyAgreement
            | KeyUsage.keyCertSign));

/*
 
View Full Code Here

      sslClient: the certificate is selectable by the client
      the certificate can be used for mime encryption.
      (perhaps the above should be settable. It is not clear that most certs should be used that way, as their life
    span could be very short)
*/
    certGenerator.addExtension(MiscObjectIdentifiers.netscapeCertType,
        false, new NetscapeCertType(NetscapeCertType.sslClient
            | NetscapeCertType.smime));

    /*
          * Adds the authority key identifier extension.
View Full Code Here

/*
    Adds the subject key identifier extension.
*/
    SubjectKeyIdentifier subjectKeyIdentifier = new SubjectKeyIdentifierStructure(
        getSubjectPublicKey().getPublicKey());
    certGenerator.addExtension(X509Extension.subjectKeyIdentifier, false,
        subjectKeyIdentifier);

/*
    Adds the subject alternative-name extension (critical).
*/
 
View Full Code Here

    }
    if (sans.size() == 1) {
      GeneralNames subjectAltNames = new GeneralNames(new GeneralName(
          GeneralName.uniformResourceIdentifier, webId));

      certGenerator.addExtension(X509Extension.subjectAlternativeName,
          true, subjectAltNames);
    } else {
      // BouncyCastle has a pretty inflexible API. It would have made more sense to just
      // pass an array of Names to the constructor.
      GeneralName[] names = new GeneralName[sans.size()];
View Full Code Here

      int i = 0;
      while (sanIt.hasNext()) {
        names[i] = new GeneralName(GeneralName.uniformResourceIdentifier, sanIt.next());
        i++;
      }
      certGenerator.addExtension(X509Extension.subjectAlternativeName,
          true, new DERSequence(names));

    }

/*
 
View Full Code Here

   
    // Firefox actually tracks serial numbers within a CA and refuses to validate if it sees duplicates
    // This is not a secure serial number generator, (duh!) but it's good enough for our purposes.
    v3CertGen.setSerialNumber(new BigInteger(Long.toString(System.currentTimeMillis())));

    v3CertGen.addExtension(
        X509Extensions.BasicConstraints,
        true,
        new BasicConstraints(false) );
   
    v3CertGen.addExtension(
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.