本文整理汇总了Java中org.bouncycastle.asn1.x509.AttributeCertificate类的典型用法代码示例。如果您正苦于以下问题:Java AttributeCertificate类的具体用法?Java AttributeCertificate怎么用?Java AttributeCertificate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttributeCertificate类属于org.bouncycastle.asn1.x509包,在下文中一共展示了AttributeCertificate类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: X509V2AttributeCertificate
import org.bouncycastle.asn1.x509.AttributeCertificate; //导入依赖的package包/类
X509V2AttributeCertificate(
AttributeCertificate cert)
throws IOException
{
this.cert = cert;
try
{
this.notAfter = cert.getAcinfo().getAttrCertValidityPeriod().getNotAfterTime().getDate();
this.notBefore = cert.getAcinfo().getAttrCertValidityPeriod().getNotBeforeTime().getDate();
}
catch (ParseException e)
{
throw new IOException("invalid data structure in certificate!");
}
}
示例2: toASN1Primitive
import org.bouncycastle.asn1.x509.AttributeCertificate; //导入依赖的package包/类
/**
*
* <pre>
* SignerAttribute ::= SEQUENCE OF CHOICE {
* claimedAttributes [0] ClaimedAttributes,
* certifiedAttributes [1] CertifiedAttributes }
*
* ClaimedAttributes ::= SEQUENCE OF Attribute
* CertifiedAttributes ::= AttributeCertificate -- as defined in RFC 3281: see clause 4.1.
* </pre>
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
for (int i = 0; i != values.length; i++)
{
if (values[i] instanceof Attribute[])
{
v.add(new DERTaggedObject(0, new DERSequence((Attribute[])values[i])));
}
else
{
v.add(new DERTaggedObject(1, (AttributeCertificate)values[i]));
}
}
return new DERSequence(v);
}
示例3: getInstance
import org.bouncycastle.asn1.x509.AttributeCertificate; //导入依赖的package包/类
public static CMPCertificate getInstance(Object o)
{
if (o == null || o instanceof CMPCertificate)
{
return (CMPCertificate)o;
}
if (o instanceof ASN1Sequence || o instanceof byte[])
{
return new CMPCertificate(Certificate.getInstance(o));
}
if (o instanceof ASN1TaggedObject)
{
return new CMPCertificate(AttributeCertificate.getInstance(((ASN1TaggedObject)o).getObject()));
}
throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
}
示例4: getAttributeCertificates
import org.bouncycastle.asn1.x509.AttributeCertificate; //导入依赖的package包/类
Store getAttributeCertificates(ASN1Set certSet)
{
if (certSet != null)
{
List certList = new ArrayList(certSet.size());
for (Enumeration en = certSet.getObjects(); en.hasMoreElements();)
{
ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();
if (obj instanceof ASN1TaggedObject)
{
certList.add(new X509AttributeCertificateHolder(AttributeCertificate.getInstance(((ASN1TaggedObject)obj).getObject())));
}
}
return new CollectionStore(certList);
}
return new CollectionStore(new ArrayList());
}
示例5: getAttributeCertificates
import org.bouncycastle.asn1.x509.AttributeCertificate; //导入依赖的package包/类
public Store getAttributeCertificates()
{
ASN1Set certSet = signedData.getCertificates();
if (certSet != null)
{
List certList = new ArrayList(certSet.size());
for (Enumeration en = certSet.getObjects(); en.hasMoreElements();)
{
ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();
if (obj instanceof ASN1TaggedObject)
{
certList.add(new X509AttributeCertificateHolder(AttributeCertificate.getInstance(((ASN1TaggedObject)obj).getObject())));
}
}
return new CollectionStore(certList);
}
return new CollectionStore(new ArrayList());
}
示例6: VOMSAttributeCertificate
import org.bouncycastle.asn1.x509.AttributeCertificate; //导入依赖的package包/类
public VOMSAttributeCertificate( AttributeCertificate ac )
{
this.ac = ac ;
//----------------------------------------------------------------------------
// first level
acinfo = ac.getAcinfo() ;
signatureAlgorithm = ac.getSignatureAlgorithm() ;
signatureValue = ac.getSignatureValue() ;
//----------------------------------------------------------------------------
// second level therefore is the acinfo - this has 9 subparts
version = acinfo.getVersion() ;
holder = acinfo.getHolder() ;
issuer = acinfo.getIssuer() ;
signature = acinfo.getSignature() ;
serialNumber = acinfo.getSerialNumber() ;
attrCertValidityPeriod = acinfo.getAttrCertValidityPeriod() ;
attributes = acinfo.getAttributes() ;
issuerUniqueID = acinfo.getIssuerUniqueID() ; // OPTIONAL
extensions = acinfo.getExtensions() ; // OPTIONAL
}
示例7: generate
import org.bouncycastle.asn1.x509.AttributeCertificate; //导入依赖的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);
}
}
示例8: generateAttrStructure
import org.bouncycastle.asn1.x509.AttributeCertificate; //导入依赖的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));
}
示例9: SignerAttribute
import org.bouncycastle.asn1.x509.AttributeCertificate; //导入依赖的package包/类
private SignerAttribute(
ASN1Sequence seq)
{
int index = 0;
values = new Object[seq.size()];
for (Enumeration e = seq.getObjects(); e.hasMoreElements();)
{
ASN1TaggedObject taggedObject = ASN1TaggedObject.getInstance(e.nextElement());
if (taggedObject.getTagNo() == 0)
{
ASN1Sequence attrs = ASN1Sequence.getInstance(taggedObject, true);
Attribute[] attributes = new Attribute[attrs.size()];
for (int i = 0; i != attributes.length; i++)
{
attributes[i] = Attribute.getInstance(attrs.getObjectAt(i));
}
values[index] = attributes;
}
else if (taggedObject.getTagNo() == 1)
{
values[index] = AttributeCertificate.getInstance(ASN1Sequence.getInstance(taggedObject, true));
}
else
{
throw new IllegalArgumentException("illegal tag: " + taggedObject.getTagNo());
}
index++;
}
}