本文整理汇总了Java中org.bouncycastle.asn1.x509.AttributeCertificateInfo类的典型用法代码示例。如果您正苦于以下问题:Java AttributeCertificateInfo类的具体用法?Java AttributeCertificateInfo怎么用?Java AttributeCertificateInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttributeCertificateInfo类属于org.bouncycastle.asn1.x509包,在下文中一共展示了AttributeCertificateInfo类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generate
import org.bouncycastle.asn1.x509.AttributeCertificateInfo; //导入依赖的package包/类
/**
* generate an X509 certificate, based on the current issuer and subject,
* using the passed in provider for the signing and the supplied source
* of randomness, if required.
*/
public X509AttributeCertificate generate(
PrivateKey key,
String provider,
SecureRandom random)
throws CertificateEncodingException, IllegalStateException, NoSuchProviderException, NoSuchAlgorithmException, SignatureException, InvalidKeyException
{
if (!extGenerator.isEmpty())
{
acInfoGen.setExtensions(extGenerator.generate());
}
AttributeCertificateInfo acInfo = acInfoGen.generateAttributeCertificateInfo();
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(acInfo);
v.add(sigAlgId);
try
{
v.add(new DERBitString(X509Util.calculateSignature(sigOID, signatureAlgorithm, provider, key, random, acInfo)));
return new X509V2AttributeCertificate(new AttributeCertificate(new DERSequence(v)));
}
catch (IOException e)
{
throw new ExtCertificateEncodingException("constructed invalid certificate", e);
}
}
开发者ID:Appdome,项目名称:ipack,代码行数:35,代码来源:X509V2AttributeCertificateGenerator.java
示例2: generateFullAttrCert
import org.bouncycastle.asn1.x509.AttributeCertificateInfo; //导入依赖的package包/类
static X509AttributeCertificateHolder generateFullAttrCert(ContentSigner signer, AttributeCertificateInfo attrInfo)
{
try
{
return new X509AttributeCertificateHolder(generateAttrStructure(attrInfo, signer.getAlgorithmIdentifier(), generateSig(signer, attrInfo)));
}
catch (IOException e)
{
throw new IllegalStateException("cannot produce attribute certificate signature");
}
}
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:CertUtils.java
示例3: generateAttrStructure
import org.bouncycastle.asn1.x509.AttributeCertificateInfo; //导入依赖的package包/类
private static AttributeCertificate generateAttrStructure(AttributeCertificateInfo attrInfo, AlgorithmIdentifier sigAlgId, byte[] signature)
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(attrInfo);
v.add(sigAlgId);
v.add(new DERBitString(signature));
return AttributeCertificate.getInstance(new DERSequence(v));
}
开发者ID:Appdome,项目名称:ipack,代码行数:11,代码来源:CertUtils.java
示例4: isSignatureValid
import org.bouncycastle.asn1.x509.AttributeCertificateInfo; //导入依赖的package包/类
/**
* Validate the signature on the attribute certificate in this holder.
*
* @param verifierProvider a ContentVerifierProvider that can generate a verifier for the signature.
* @return true if the signature is valid, false otherwise.
* @throws CertException if the signature cannot be processed or is inappropriate.
*/
public boolean isSignatureValid(ContentVerifierProvider verifierProvider)
throws CertException
{
AttributeCertificateInfo acinfo = attrCert.getAcinfo();
if (!CertUtils.isAlgIdEqual(acinfo.getSignature(), attrCert.getSignatureAlgorithm()))
{
throw new CertException("signature invalid - algorithm identifier mismatch");
}
ContentVerifier verifier;
try
{
verifier = verifierProvider.get((acinfo.getSignature()));
OutputStream sOut = verifier.getOutputStream();
DEROutputStream dOut = new DEROutputStream(sOut);
dOut.writeObject(acinfo);
sOut.close();
}
catch (Exception e)
{
throw new CertException("unable to process signature: " + e.getMessage(), e);
}
return verifier.verify(attrCert.getSignatureValue().getBytes());
}
开发者ID:Appdome,项目名称:ipack,代码行数:38,代码来源:X509AttributeCertificateHolder.java
示例5: isSignatureValid
import org.bouncycastle.asn1.x509.AttributeCertificateInfo; //导入依赖的package包/类
/**
* Validate the signature on the attribute certificate in this holder.
*
* @param verifierProvider a ContentVerifierProvider that can generate a verifier for the signature.
* @return true if the signature is valid, false otherwise.
* @throws CertException if the signature cannot be processed or is inappropriate.
*/
public boolean isSignatureValid(ContentVerifierProvider verifierProvider)
throws CertException
{
AttributeCertificateInfo acinfo = attrCert.getAcinfo();
if (!CertUtils.isAlgIdEqual(acinfo.getSignature(), attrCert.getSignatureAlgorithm()))
{
throw new CertException("signature invalid - algorithm identifier mismatch");
}
ContentVerifier verifier;
try
{
verifier = verifierProvider.get((acinfo.getSignature()));
OutputStream sOut = verifier.getOutputStream();
DEROutputStream dOut = new DEROutputStream(sOut);
dOut.writeObject(acinfo);
sOut.close();
}
catch (Exception e)
{
throw new CertException("unable to process signature: " + e.getMessage(), e);
}
return verifier.verify(this.getSignature());
}
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:38,代码来源:X509AttributeCertificateHolder.java
示例6: getCertifiedSignerRoles
import org.bouncycastle.asn1.x509.AttributeCertificateInfo; //导入依赖的package包/类
@Override
public List<CertifiedRole> getCertifiedSignerRoles() {
final Attribute id_aa_ets_signerAttr = getSignedAttribute(PKCSObjectIdentifiers.id_aa_ets_signerAttr);
if (id_aa_ets_signerAttr == null) {
return null;
}
final ASN1Set attrValues = id_aa_ets_signerAttr.getAttrValues();
final ASN1Encodable asn1EncodableAttrValue = attrValues.getObjectAt(0);
try {
final SignerAttribute signerAttr = SignerAttribute.getInstance(asn1EncodableAttrValue);
if (signerAttr == null) {
return null;
}
List<CertifiedRole> roles = null;
final Object[] signerAttrValues = signerAttr.getValues();
for (final Object signerAttrValue : signerAttrValues) {
if (signerAttrValue instanceof AttributeCertificate) {
if (roles == null) {
roles = new ArrayList<CertifiedRole>();
}
final AttributeCertificate attributeCertificate = (AttributeCertificate) signerAttrValue;
final AttributeCertificateInfo acInfo = attributeCertificate.getAcinfo();
final AttCertValidityPeriod attrCertValidityPeriod = acInfo.getAttrCertValidityPeriod();
final ASN1Sequence attributes = acInfo.getAttributes();
for (int ii = 0; ii < attributes.size(); ii++) {
final ASN1Encodable objectAt = attributes.getObjectAt(ii);
final org.bouncycastle.asn1.x509.Attribute attribute = org.bouncycastle.asn1.x509.Attribute.getInstance(objectAt);
final ASN1Set attrValues1 = attribute.getAttrValues();
DERSequence derSequence = (DERSequence) attrValues1.getObjectAt(0);
RoleSyntax roleSyntax = RoleSyntax.getInstance(derSequence);
CertifiedRole certifiedRole = new CertifiedRole();
certifiedRole.setRole(roleSyntax.getRoleNameAsString());
certifiedRole.setNotBefore(DSSASN1Utils.toDate(attrCertValidityPeriod.getNotBeforeTime()));
certifiedRole.setNotAfter(DSSASN1Utils.toDate(attrCertValidityPeriod.getNotAfterTime()));
roles.add(certifiedRole);
}
}
}
return roles;
} catch (Exception e) {
LOG.error("Error when dealing with certified signer roles: [" + asn1EncodableAttrValue.toString() + "]", e);
return null;
}
}
开发者ID:esig,项目名称:dss,代码行数:50,代码来源:CAdESSignature.java
示例7: VOMSAttributeCertificate
import org.bouncycastle.asn1.x509.AttributeCertificateInfo; //导入依赖的package包/类
public VOMSAttributeCertificate( String holderString , int holderSerialNumber , String issuerString , int productionSerial , long fromEpoch , long toEpoch , String[] fqans ) throws Exception
{
try
{
DEREncodableVector infoVector = new ASN1EncodableVector() ;
this.setVersion() ;
this.setHolder( holderString , holderSerialNumber ) ;
this.setIssuer( issuerString ) ;
this.setAlgorithmIdentifier() ;
this.setSerialNumber( productionSerial ) ;
this.setTimes( new Date ( fromEpoch ) , new Date( toEpoch ) ) ;
this.setVOMSFQANs( fqans ) ;
this.setExtensions() ;
infoVector.add( version ) ;
infoVector.add( holder ) ;
infoVector.add( issuer ) ;
infoVector.add( signature ) ;
infoVector.add( serialNumber ) ;
infoVector.add( attrCertValidityPeriod ) ;
infoVector.add( attributes ) ;
infoVector.add( extensions ) ;
ASN1Sequence infoSequence = ASN1Sequence.getInstance( new DERSequence( infoVector ) ) ;
this.acinfo = new AttributeCertificateInfo( infoSequence ) ;
// Do it this way to match Vincenzo as much as possible
// - rather than this way... this.signatureAlgorithm = new AlgorithmIdentifier( "1.2.840.113549.1.1.4" ) ;
this.signatureAlgorithm = new AlgorithmIdentifier( new DERObjectIdentifier( "1.2.840.113549.1.1.4" ) , (DEREncodable)null ) ;
this.signatureValue = new DERBitString( this.sign() ) ;
this.ac = new AttributeCertificate( acinfo , signatureAlgorithm , signatureValue ) ;
}
catch( Exception e )
{
// inspect?:
throw e ;
}
}
开发者ID:NLeSC,项目名称:vbrowser,代码行数:45,代码来源:VOMSAttributeCertificate.java
注:本文中的org.bouncycastle.asn1.x509.AttributeCertificateInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论