Java 类org.bouncycastle.asn1.x509.CertificatePolicies 实例源码

项目:keystore-explorer    文件:DCertificatePolicies.java   
private void okPressed() {
    List<PolicyInformation> policyInformation = jpiCertificatePolicies.getPolicyInformation();

    if (policyInformation.size() == 0) {
        JOptionPane.showMessageDialog(this, res.getString("DCertificatePolicies.ValueReq.message"), getTitle(),
                JOptionPane.WARNING_MESSAGE);
        return;
    }



    CertificatePolicies certificatePolicies = new CertificatePolicies(policyInformation.toArray(
            new PolicyInformation[policyInformation.size()]));

    try {
        value = certificatePolicies.getEncoded(ASN1Encoding.DER);
    } catch (IOException ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }

    closeDialog();
}
项目:CryptMeme    文件:PKIXPolicyMappingTest.java   
/**
 * intermediate cert
 */
private X509Certificate createIntmedCert(
    PublicKey           pubKey,
    PrivateKey          caPrivKey,
    PublicKey           caPubKey,
    CertificatePolicies policies,
    Hashtable           policyMap)
    throws Exception
{
    String  issuer  = "C=JP, O=policyMappingAdditionalTest, OU=trustAnchor";
    String  subject = "C=JP, O=policyMappingAdditionalTest, OU=intmedCA";
    v3CertGen.reset();
    v3CertGen.setSerialNumber(BigInteger.valueOf(20));
    v3CertGen.setIssuerDN(new X509Principal(issuer));
    v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30));
    v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 30)));
    v3CertGen.setSubjectDN(new X509Principal(subject));
    v3CertGen.setPublicKey(pubKey);
    v3CertGen.setSignatureAlgorithm("SHA1WithRSAEncryption");
    v3CertGen.addExtension(X509Extensions.CertificatePolicies, true, policies);
    v3CertGen.addExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(true));
    v3CertGen.addExtension(X509Extensions.PolicyMappings, true, new PolicyMappings(policyMap));
    X509Certificate cert = v3CertGen.generate(caPrivKey);
    return cert;
}
项目:CryptMeme    文件:PKIXPolicyMappingTest.java   
/**
 * endEntity cert
 */
private X509Certificate createEndEntityCert(
    PublicKey           pubKey,
    PrivateKey          caPrivKey,
    PublicKey           caPubKey,
    ASN1EncodableVector policies)
    throws Exception
{
    String  issuer  = "C=JP, O=policyMappingAdditionalTest, OU=intMedCA";
    String  subject = "C=JP, O=policyMappingAdditionalTest, OU=endEntity";
    v3CertGen.reset();
    v3CertGen.setSerialNumber(BigInteger.valueOf(20));
    v3CertGen.setIssuerDN(new X509Principal(issuer));
    v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30));
    v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 30)));
    v3CertGen.setSubjectDN(new X509Principal(subject));
    v3CertGen.setPublicKey(pubKey);
    v3CertGen.setSignatureAlgorithm("SHA1WithRSAEncryption");
    v3CertGen.addExtension(X509Extensions.CertificatePolicies,true,new DERSequence(policies));
    X509Certificate cert = v3CertGen.generate(caPrivKey);
    return cert;
}
项目:irma_future_id    文件:PKIXPolicyMappingTest.java   
/**
 * intermediate cert
 */
private X509Certificate createIntmedCert(
    PublicKey           pubKey,
    PrivateKey          caPrivKey,
    PublicKey           caPubKey,
    CertificatePolicies policies,
    Hashtable           policyMap)
    throws Exception
{
    String  issuer  = "C=JP, O=policyMappingAdditionalTest, OU=trustAnchor";
    String  subject = "C=JP, O=policyMappingAdditionalTest, OU=intmedCA";
    v3CertGen.reset();
    v3CertGen.setSerialNumber(BigInteger.valueOf(20));
    v3CertGen.setIssuerDN(new X509Principal(issuer));
    v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30));
    v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 30)));
    v3CertGen.setSubjectDN(new X509Principal(subject));
    v3CertGen.setPublicKey(pubKey);
    v3CertGen.setSignatureAlgorithm("SHA1WithRSAEncryption");
    v3CertGen.addExtension(X509Extensions.CertificatePolicies, true, policies);
    v3CertGen.addExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(true));
    v3CertGen.addExtension(X509Extensions.PolicyMappings, true, new PolicyMappings(policyMap));
    X509Certificate cert = v3CertGen.generate(caPrivKey);
    return cert;
}
项目:irma_future_id    文件:PKIXPolicyMappingTest.java   
/**
 * endEntity cert
 */
private X509Certificate createEndEntityCert(
    PublicKey           pubKey,
    PrivateKey          caPrivKey,
    PublicKey           caPubKey,
    ASN1EncodableVector policies)
    throws Exception
{
    String  issuer  = "C=JP, O=policyMappingAdditionalTest, OU=intMedCA";
    String  subject = "C=JP, O=policyMappingAdditionalTest, OU=endEntity";
    v3CertGen.reset();
    v3CertGen.setSerialNumber(BigInteger.valueOf(20));
    v3CertGen.setIssuerDN(new X509Principal(issuer));
    v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30));
    v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 30)));
    v3CertGen.setSubjectDN(new X509Principal(subject));
    v3CertGen.setPublicKey(pubKey);
    v3CertGen.setSignatureAlgorithm("SHA1WithRSAEncryption");
    v3CertGen.addExtension(X509Extensions.CertificatePolicies,true,new DERSequence(policies));
    X509Certificate cert = v3CertGen.generate(caPrivKey);
    return cert;
}
项目:bc-java    文件:PKIXPolicyMappingTest.java   
/**
 * intermediate cert
 */
private X509Certificate createIntmedCert(
    PublicKey           pubKey,
    PrivateKey          caPrivKey,
    PublicKey           caPubKey,
    CertificatePolicies policies,
    Hashtable           policyMap)
    throws Exception
{
    String  issuer  = "C=JP, O=policyMappingAdditionalTest, OU=trustAnchor";
    String  subject = "C=JP, O=policyMappingAdditionalTest, OU=intmedCA";
    v3CertGen.reset();
    v3CertGen.setSerialNumber(BigInteger.valueOf(20));
    v3CertGen.setIssuerDN(new X509Principal(issuer));
    v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30));
    v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 30)));
    v3CertGen.setSubjectDN(new X509Principal(subject));
    v3CertGen.setPublicKey(pubKey);
    v3CertGen.setSignatureAlgorithm("SHA1WithRSAEncryption");
    v3CertGen.addExtension(X509Extensions.CertificatePolicies, true, policies);
    v3CertGen.addExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(true));
    v3CertGen.addExtension(X509Extensions.PolicyMappings, true, new PolicyMappings(policyMap));
    X509Certificate cert = v3CertGen.generate(caPrivKey);
    return cert;
}
项目:bc-java    文件:PKIXPolicyMappingTest.java   
/**
 * endEntity cert
 */
private X509Certificate createEndEntityCert(
    PublicKey           pubKey,
    PrivateKey          caPrivKey,
    PublicKey           caPubKey,
    ASN1EncodableVector policies)
    throws Exception
{
    String  issuer  = "C=JP, O=policyMappingAdditionalTest, OU=intMedCA";
    String  subject = "C=JP, O=policyMappingAdditionalTest, OU=endEntity";
    v3CertGen.reset();
    v3CertGen.setSerialNumber(BigInteger.valueOf(20));
    v3CertGen.setIssuerDN(new X509Principal(issuer));
    v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30));
    v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 30)));
    v3CertGen.setSubjectDN(new X509Principal(subject));
    v3CertGen.setPublicKey(pubKey);
    v3CertGen.setSignatureAlgorithm("SHA1WithRSAEncryption");
    v3CertGen.addExtension(X509Extensions.CertificatePolicies,true,new DERSequence(policies));
    X509Certificate cert = v3CertGen.generate(caPrivKey);
    return cert;
}
项目:keystore-explorer    文件:DCertificatePolicies.java   
private void prepopulateWithValue(byte[] value) throws IOException {
    CertificatePolicies certificatePolicies = CertificatePolicies.getInstance(value);

    List<PolicyInformation> accessDescriptionList =
            new ArrayList<PolicyInformation>(Arrays.asList(certificatePolicies.getPolicyInformation()));

    jpiCertificatePolicies.setPolicyInformation(accessDescriptionList);
}