• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java AttributeCertificateHolder类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.bouncycastle.cert.AttributeCertificateHolder的典型用法代码示例。如果您正苦于以下问题:Java AttributeCertificateHolder类的具体用法?Java AttributeCertificateHolder怎么用?Java AttributeCertificateHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

AttributeCertificateHolder类属于org.bouncycastle.cert包,在下文中一共展示了AttributeCertificateHolder类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: X509AttributeCertificateHolderSelector

点赞 3

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
X509AttributeCertificateHolderSelector(
    AttributeCertificateHolder holder,
    AttributeCertificateIssuer issuer,
    BigInteger serialNumber,
    Date attributeCertificateValid,
    X509AttributeCertificateHolder attributeCert,
    Collection targetNames,
    Collection targetGroups)
{
    this.holder = holder;
    this.issuer = issuer;
    this.serialNumber = serialNumber;
    this.attributeCertificateValid = attributeCertificateValid;
    this.attributeCert = attributeCert;
    this.targetNames = targetNames;
    this.targetGroups = targetGroups;
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:18,
代码来源:X509AttributeCertificateHolderSelector.java

示例2: certRecursive

点赞 3

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
private void certRecursive( List<CertificateInfo> chains ,
		Store store1, X509CertificateHolder certholder )
		throws CertificateException {
	
	AttributeCertificateHolder selec = new AttributeCertificateHolder(
			certholder.getIssuer());
	
	Collection<X509CertificateHolder> holdersd = store1.getMatches(selec);

	for (X509CertificateHolder certholder2 : holdersd) {
		X509Certificate c2 = jcaX509CertificateConverter
				.getCertificate(certholder2);
		CertificateInfo parent = new CertificateInfo();
		adattaCertificate(c2, parent);
		certRecursive(chains, store1, certholder2 );
		chains.add(parent);
	}
	
}
 

开发者ID:tornabene,
项目名称:jopenpec,
代码行数:20,
代码来源:PECVerifier.java

示例3: testCertWithBaseCertificateID

点赞 2

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
private void testCertWithBaseCertificateID()
    throws Exception
{
    X509AttributeCertificateHolder attrCert = new X509AttributeCertificateHolder(certWithBaseCertificateID);
    X509CertificateHolder    cert = new X509CertificateHolder(holderCertWithBaseCertificateID);
    
    AttributeCertificateHolder holder = attrCert.getHolder();
    
    if (holder.getEntityNames() != null)
    {
        fail("entity names set when none expected");
    }
    
    if (!holder.getSerialNumber().equals(cert.getSerialNumber()))
    {
        fail("holder serial number doesn't match");
    }

    if (!holder.getIssuer()[0].equals(cert.getIssuer()))
    {
        fail("holder issuer doesn't match");
    }
    
    if (!holder.match(cert))
    {
        fail("holder not matching holder certificate");
    }

    if (!holder.equals(holder.clone()))
    {
        fail("holder clone test failed");
    }

    if (!attrCert.getIssuer().equals(attrCert.getIssuer().clone()))
    {
        fail("issuer clone test failed");
    }
    
    //equalityAndHashCodeTest(attrCert, certWithBaseCertificateID);
}
 

开发者ID:ttt43ttt,
项目名称:gwt-crypto,
代码行数:41,
代码来源:AttrCertTest.java

示例4: testCertWithBaseCertificateID

点赞 2

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
public void testCertWithBaseCertificateID()
    throws Exception
{
    X509AttributeCertificateHolder attrCert = new X509AttributeCertificateHolder(certWithBaseCertificateID);
    X509CertificateHolder cert = new X509CertificateHolder(holderCertWithBaseCertificateID);
    
    AttributeCertificateHolder holder = attrCert.getHolder();
    
    if (holder.getEntityNames() != null)
    {
        fail("entity names set when none expected");
    }
    
    if (!holder.getSerialNumber().equals(cert.getSerialNumber()))
    {
        fail("holder serial number doesn't match");
    }

    if (!holder.getIssuer()[0].equals(cert.getIssuer()))
    {
        fail("holder issuer doesn't match");
    }
    
    if (!holder.match(cert))
    {
        fail("holder not matching holder certificate");
    }

    if (!holder.equals(holder.clone()))
    {
        fail("holder clone test failed");
    }

    if (!attrCert.getIssuer().equals(attrCert.getIssuer().clone()))
    {
        fail("issuer clone test failed");
    }
    
    //equalityAndHashCodeTest(attrCert, certWithBaseCertificateID);
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:41,
代码来源:BcAttrCertTest.java

示例5: testGenerateWithPrincipal

点赞 2

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
private void testGenerateWithPrincipal()
    throws Exception
{
    X509CertificateHolder             iCert = new X509CertificateHolder(signCert);
    
    //
    // a sample key pair.
    //
    RSAKeyParameters pubKey = new RSAKeyParameters(false,
        new BigInteger("b4a7e46170574f16a97082b22be58b6a2a629798419be12872a4bdba626cfae9900f76abfb12139dce5de56564fab2b6543165a040c606887420e33d91ed7ed7", 16),
        new BigInteger("11", 16));

    //
    // set up the keys
    //
    X509v2AttributeCertificateBuilder gen = new X509v2AttributeCertificateBuilder(
        new AttributeCertificateHolder(iCert.getSubject()),
        new AttributeCertificateIssuer(new X500Name("cn=test")),
        BigInteger.ONE,
        new Date(System.currentTimeMillis() - 50000),
        new Date(System.currentTimeMillis() + 50000));
    
    // the actual attributes
    GeneralName roleName = new GeneralName(GeneralName.rfc822Name, "DAU123456789");
    ASN1EncodableVector roleSyntax = new ASN1EncodableVector();
    roleSyntax.add(roleName);

    // roleSyntax OID: 2.5.24.72

    gen.addAttribute(new ASN1ObjectIdentifier("2.5.24.72"), new DERSequence(roleSyntax));

    AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find("SHA1WithRSAEncryption");
    AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder().find(sigAlgId);

    ContentSigner sigGen = new BcRSAContentSignerBuilder(sigAlgId, digAlgId).build(RSA_PRIVATE_KEY);

    X509AttributeCertificateHolder aCert = gen.build(sigGen);
    
    if (!aCert.isValidOn(new Date()))
    {
        fail("certificate invalid");
    }
    
    if (!aCert.isSignatureValid(new BcRSAContentVerifierProviderBuilder(new DefaultDigestAlgorithmIdentifierFinder()).build(pubKey)))
    {
        fail("certificate signature not valid");
    }
    
    AttributeCertificateHolder holder = aCert.getHolder();
    
    if (holder.getEntityNames() == null)
    {
        fail("entity names not set when expected");
    }
    
    if (holder.getSerialNumber() != null)
    {
        fail("holder serial number found when none expected");
    }

    if (holder.getIssuer() != null)
    {
        fail("holder issuer found when none expected");
    }
    
    if (!holder.match(iCert))
    {
        fail("generated holder not matching holder certificate");
    }
    
    X509CertificateHolder             sCert = new X509CertificateHolder(holderCertWithBaseCertificateID);
    
    if (holder.match(sCert))
    {
        fail("principal generated holder matching wrong certificate");
    }

    equalityAndHashCodeTest(aCert, aCert.getEncoded());
}
 

开发者ID:ttt43ttt,
项目名称:gwt-crypto,
代码行数:80,
代码来源:AttrCertTest.java

示例6: createAttrCert

点赞 2

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
private X509AttributeCertificateHolder createAttrCert() throws Exception
{
    X509CertificateHolder iCertHolder = new X509CertificateHolder(holderCert);
    //
    // a sample key pair.
    //
    // RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(
    // new BigInteger(
    // "b4a7e46170574f16a97082b22be58b6a2a629798419be12872a4bdba626cfae9900f76abfb12139dce5de56564fab2b6543165a040c606887420e33d91ed7ed7",
    // 16), new BigInteger("11", 16));

    //
    // set up the keys
    //
    X509v2AttributeCertificateBuilder gen = new X509v2AttributeCertificateBuilder(
            new AttributeCertificateHolder(iCertHolder.getSubject()),
            new AttributeCertificateIssuer(new X500Name("cn=test")),
            BigInteger.valueOf(1),
            new Date(System.currentTimeMillis() - 50000),
            new Date(System.currentTimeMillis() + 50000));

    // the actual attributes
    GeneralName roleName = new GeneralName(GeneralName.rfc822Name,
        "[email protected]");
    ASN1EncodableVector roleSyntax = new ASN1EncodableVector();
    roleSyntax.add(roleName);

    // roleSyntax OID: 2.5.24.72
    gen.addAttribute(new ASN1ObjectIdentifier("2.5.24.72"), new DERSequence(roleSyntax));

    AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find("SHA1WithRSAEncryption");
    AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder().find(sigAlgId);

    ContentSigner sigGen = new BcRSAContentSignerBuilder(sigAlgId, digAlgId).build(RSA_PRIVATE_KEY);

    Target targetName = new Target(Target.targetName, new GeneralName(GeneralName.dNSName,
        "www.test.com"));

    Target targetGroup = new Target(Target.targetGroup, new GeneralName(
        GeneralName.directoryName, "o=Test, ou=Test"));
    Target[] targets = new Target[2];
    targets[0] = targetName;
    targets[1] = targetGroup;
    TargetInformation targetInformation = new TargetInformation(targets);

    gen.addExtension(X509Extension.targetInformation, true, targetInformation);

    return gen.build(sigGen);
}
 

开发者ID:ttt43ttt,
项目名称:gwt-crypto,
代码行数:50,
代码来源:AttrCertSelectorTest.java

示例7: createAttrCert

点赞 2

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
private X509AttributeCertificateHolder createAttrCert() throws Exception
{
    X509CertificateHolder iCertHolder = new X509CertificateHolder(holderCert);
    //
    // a sample key pair.
    //
    // RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(
    // new BigInteger(
    // "b4a7e46170574f16a97082b22be58b6a2a629798419be12872a4bdba626cfae9900f76abfb12139dce5de56564fab2b6543165a040c606887420e33d91ed7ed7",
    // 16), new BigInteger("11", 16));

    X509v2AttributeCertificateBuilder gen = new X509v2AttributeCertificateBuilder(
            new AttributeCertificateHolder(iCertHolder.getSubject()),
            new AttributeCertificateIssuer(new X500Name("cn=test")),
            BigInteger.ONE,
            new Date(System.currentTimeMillis() - 50000),
            new Date(System.currentTimeMillis() + 50000));

    // the actual attributes
    GeneralName roleName = new GeneralName(GeneralName.rfc822Name,
        "[email protected]");
    ASN1EncodableVector roleSyntax = new ASN1EncodableVector();
    roleSyntax.add(roleName);

    // roleSyntax OID: 2.5.24.72
    gen.addAttribute(new ASN1ObjectIdentifier("2.5.24.72"), new DERSequence(roleSyntax));


    AlgorithmIdentifier sigAlg = sigAlgFinder.find("SHA1withRSA");
    AlgorithmIdentifier digAlg = digAlgFinder.find(sigAlg);

    ContentSigner sigGen = new BcRSAContentSignerBuilder(sigAlg, digAlg).build(RSA_PRIVATE_KEY_SPEC);
    Target targetName = new Target(Target.targetName, new GeneralName(GeneralName.dNSName,
        "www.test.com"));

    Target targetGroup = new Target(Target.targetGroup, new GeneralName(
        GeneralName.directoryName, "o=Test, ou=Test"));
    Target[] targets = new Target[2];
    targets[0] = targetName;
    targets[1] = targetGroup;
    TargetInformation targetInformation = new TargetInformation(targets);

    gen.addExtension(Extension.targetInformation, true, targetInformation);

    return gen.build(sigGen);
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:47,
代码来源:BcAttrCertSelectorTest.java

示例8: testGenerateWithPrincipal

点赞 2

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
public void testGenerateWithPrincipal()
    throws Exception
{
    X509CertificateHolder iCert = new X509CertificateHolder(signCert);
    
    //
    // a sample key pair.
    //
    RSAKeyParameters pubKey = new RSAKeyParameters(
        false,
        new BigInteger("b4a7e46170574f16a97082b22be58b6a2a629798419be12872a4bdba626cfae9900f76abfb12139dce5de56564fab2b6543165a040c606887420e33d91ed7ed7", 16),
        new BigInteger("11", 16));

    //
    // set up the keys
    //
    AsymmetricKeyParameter          privKey = RSA_PRIVATE_KEY_SPEC;

    X509v2AttributeCertificateBuilder gen = new X509v2AttributeCertificateBuilder(
        new AttributeCertificateHolder(iCert.getSubject()),
        new AttributeCertificateIssuer(new X500Name("cn=test")),
        BigInteger.ONE,
        new Date(System.currentTimeMillis() - 50000),
        new Date(System.currentTimeMillis() + 50000));
    
    // the actual attributes
    GeneralName roleName = new GeneralName(GeneralName.rfc822Name, "DAU123456789");
    ASN1EncodableVector roleSyntax = new ASN1EncodableVector();
    roleSyntax.add(roleName);

    // roleSyntax OID: 2.5.24.72

    gen.addAttribute(new ASN1ObjectIdentifier("2.5.24.72"), new DERSequence(roleSyntax));

    AlgorithmIdentifier sigAlg = sigAlgFinder.find("SHA1withRSA");
    AlgorithmIdentifier digAlg = digAlgFinder.find(sigAlg);

    ContentSigner sigGen = new BcRSAContentSignerBuilder(sigAlg, digAlg).build(privKey);
    X509AttributeCertificateHolder aCert = gen.build(sigGen);
    
    if (!aCert.isValidOn(new Date()))
    {
        fail("certificate invalid");
    }
    
    if (!aCert.isSignatureValid(new BcRSAContentVerifierProviderBuilder(digAlgFinder).build(pubKey)))
    {
        fail("certificate signature not valid");
    }
    
    AttributeCertificateHolder holder = aCert.getHolder();
    
    if (holder.getEntityNames() == null)
    {
        fail("entity names not set when expected");
    }
    
    if (holder.getSerialNumber() != null)
    {
        fail("holder serial number found when none expected");
    }

    if (holder.getIssuer() != null)
    {
        fail("holder issuer found when none expected");
    }
    
    if (!holder.match(iCert))
    {
        fail("generated holder not matching holder certificate");
    }
    
    X509CertificateHolder            sCert = new X509CertificateHolder(holderCertWithBaseCertificateID);
    
    if (holder.match(sCert))
    {
        fail("principal generated holder matching wrong certificate");
    }

    equalityAndHashCodeTest(aCert, aCert.getEncoded());
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:82,
代码来源:BcAttrCertTest.java

示例9: testCertWithBaseCertificateID

点赞 2

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
private void testCertWithBaseCertificateID()
    throws Exception
{
    X509AttributeCertificateHolder attrCert = new X509AttributeCertificateHolder(certWithBaseCertificateID);
    CertificateFactory       fact = CertificateFactory.getInstance("X.509", "BC");   
    X509Certificate          cert = (X509Certificate)fact.generateCertificate(new ByteArrayInputStream(holderCertWithBaseCertificateID));
    
    AttributeCertificateHolder holder = attrCert.getHolder();
    
    if (holder.getEntityNames() != null)
    {
        fail("entity names set when none expected");
    }
    
    if (!holder.getSerialNumber().equals(cert.getSerialNumber()))
    {
        fail("holder serial number doesn't match");
    }

    if (!holder.getIssuer()[0].equals(X500Name.getInstance(cert.getIssuerX500Principal().getEncoded())))
    {
        fail("holder issuer doesn't match");
    }
    
    if (!holder.match(new JcaX509CertificateHolder(cert)))
    {
        fail("holder not matching holder certificate");
    }

    if (!holder.equals(holder.clone()))
    {
        fail("holder clone test failed");
    }

    if (!attrCert.getIssuer().equals(attrCert.getIssuer().clone()))
    {
        fail("issuer clone test failed");
    }
    
    //equalityAndHashCodeTest(attrCert, certWithBaseCertificateID);
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:42,
代码来源:AttrCertTest.java

示例10: createAttrCert

点赞 2

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
private X509AttributeCertificateHolder createAttrCert() throws Exception
{
    CertificateFactory fact = CertificateFactory.getInstance("X.509", "BC");
    X509Certificate iCert = (X509Certificate) fact
        .generateCertificate(new ByteArrayInputStream(holderCert));
    X509CertificateHolder iCertHolder = new JcaX509CertificateHolder(iCert);
    //
    // a sample key pair.
    //
    // RSAPublicKeySpec pubKeySpec = new RSAPublicKeySpec(
    // new BigInteger(
    // "b4a7e46170574f16a97082b22be58b6a2a629798419be12872a4bdba626cfae9900f76abfb12139dce5de56564fab2b6543165a040c606887420e33d91ed7ed7",
    // 16), new BigInteger("11", 16));

    //
    // set up the keys
    //
    PrivateKey privKey;

    KeyFactory kFact = KeyFactory.getInstance("RSA", "BC");

    privKey = kFact.generatePrivate(RSA_PRIVATE_KEY_SPEC);

    X509v2AttributeCertificateBuilder gen = new X509v2AttributeCertificateBuilder(
            new AttributeCertificateHolder(iCertHolder.getSubject()),
            new AttributeCertificateIssuer(new X500Name("cn=test")),
            BigInteger.valueOf(1),
            new Date(System.currentTimeMillis() - 50000),
            new Date(System.currentTimeMillis() + 50000));

    // the actual attributes
    GeneralName roleName = new GeneralName(GeneralName.rfc822Name,
        "[email protected]");
    ASN1EncodableVector roleSyntax = new ASN1EncodableVector();
    roleSyntax.add(roleName);

    // roleSyntax OID: 2.5.24.72
    gen.addAttribute(new ASN1ObjectIdentifier("2.5.24.72"), new DERSequence(roleSyntax));


    ContentSigner sigGen = new JcaContentSignerBuilder("SHA1WithRSAEncryption").setProvider(BC).build(privKey);

    Target targetName = new Target(Target.targetName, new GeneralName(GeneralName.dNSName,
        "www.test.com"));

    Target targetGroup = new Target(Target.targetGroup, new GeneralName(
        GeneralName.directoryName, "o=Test, ou=Test"));
    Target[] targets = new Target[2];
    targets[0] = targetName;
    targets[1] = targetGroup;
    TargetInformation targetInformation = new TargetInformation(targets);

    gen.addExtension(X509Extension.targetInformation, true, targetInformation);

    return gen.build(sigGen);
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:57,
代码来源:AttrCertSelectorTest.java

示例11: testCertWithBaseCertificateID

点赞 2

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
private void testCertWithBaseCertificateID()
    throws Exception
{
    X509AttributeCertificateHolder attrCert = new X509AttributeCertificateHolder(certWithBaseCertificateID);
    CertificateFactory       fact = CertificateFactory.getInstance("X.509", "BC");   
    X509Certificate          cert = (X509Certificate)fact.generateCertificate(new ByteArrayInputStream(holderCertWithBaseCertificateID));
    
    AttributeCertificateHolder holder = attrCert.getHolder();
    
    if (holder.getEntityNames() != null)
    {
        fail("entity names set when none expected");
    }
    
    if (!holder.getSerialNumber().equals(cert.getSerialNumber()))
    {
        fail("holder serial number doesn't match");
    }

    if (!holder.getIssuer()[0].equals(new JcaX509CertificateHolder(cert).getIssuer()))
    {
        fail("holder issuer doesn't match");
    }
    
    if (!holder.match(new JcaX509CertificateHolder(cert)))
    {
        fail("holder not matching holder certificate");
    }

    if (!holder.equals(holder.clone()))
    {
        fail("holder clone test failed");
    }

    if (!attrCert.getIssuer().equals(attrCert.getIssuer().clone()))
    {
        fail("issuer clone test failed");
    }
    
    //equalityAndHashCodeTest(attrCert, certWithBaseCertificateID);
}
 

开发者ID:credentials,
项目名称:irma_future_id,
代码行数:42,
代码来源:AttrCertTest.java

示例12: setHolder

点赞 1

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
/**
 * Sets the holder. If <code>null</code> is given any will do.
 *
 * @param holder The holder to set.
 */
public void setHolder(AttributeCertificateHolder holder)
{
    this.holder = holder;
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:10,
代码来源:X509AttributeCertificateHolderSelectorBuilder.java

示例13: getHolder

点赞 1

import org.bouncycastle.cert.AttributeCertificateHolder; //导入依赖的package包/类
/**
 * Gets the holder.
 *
 * @return Returns the holder.
 */
public AttributeCertificateHolder getHolder()
{
    return holder;
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:10,
代码来源:X509AttributeCertificateHolderSelector.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)