本文整理汇总了Java中org.bouncycastle.asn1.ASN1Set.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ASN1Set.getInstance方法的具体用法?Java ASN1Set.getInstance怎么用?Java ASN1Set.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.ASN1Set
的用法示例。
在下文中一共展示了ASN1Set.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CscaMasterList
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
private CscaMasterList(
ASN1Sequence seq)
{
if (seq == null || seq.size() == 0)
{
throw new IllegalArgumentException(
"null or empty sequence passed.");
}
if (seq.size() != 2)
{
throw new IllegalArgumentException(
"Incorrect sequence size: " + seq.size());
}
version = ASN1Integer.getInstance(seq.getObjectAt(0));
ASN1Set certSet = ASN1Set.getInstance(seq.getObjectAt(1));
certList = new Certificate[certSet.size()];
for (int i = 0; i < certList.length; i++)
{
certList[i]
= Certificate.getInstance(certSet.getObjectAt(i));
}
}
示例2: CertificationRequestInfo
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
/**
* @deprecated use getInstance().
*/
public CertificationRequestInfo(
ASN1Sequence seq)
{
version = (ASN1Integer)seq.getObjectAt(0);
subject = X500Name.getInstance(seq.getObjectAt(1));
subjectPKInfo = SubjectPublicKeyInfo.getInstance(seq.getObjectAt(2));
//
// some CertificationRequestInfo objects seem to treat this field
// as optional.
//
if (seq.size() > 3)
{
DERTaggedObject tagobj = (DERTaggedObject)seq.getObjectAt(3);
attributes = ASN1Set.getInstance(tagobj, false);
}
if ((subject == null) || (version == null) || (subjectPKInfo == null))
{
throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator.");
}
}
示例3: PrivateKeyInfo
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
/**
* @deprectaed use PrivateKeyInfo.getInstance()
* @param seq
*/
public PrivateKeyInfo(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
BigInteger version = ((ASN1Integer)e.nextElement()).getValue();
if (version.intValue() != 0)
{
throw new IllegalArgumentException("wrong version for private key info");
}
algId = AlgorithmIdentifier.getInstance(e.nextElement());
privKey = ASN1OctetString.getInstance(e.nextElement());
if (e.hasMoreElements())
{
attributes = ASN1Set.getInstance((ASN1TaggedObject)e.nextElement(), false);
}
}
示例4: SignerInfo
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
public SignerInfo(
SignerIdentifier sid,
AlgorithmIdentifier digAlgorithm,
Attributes authenticatedAttributes,
AlgorithmIdentifier digEncryptionAlgorithm,
ASN1OctetString encryptedDigest,
Attributes unauthenticatedAttributes)
{
if (sid.isTagged())
{
this.version = new ASN1Integer(3);
}
else
{
this.version = new ASN1Integer(1);
}
this.sid = sid;
this.digAlgorithm = digAlgorithm;
this.authenticatedAttributes = ASN1Set.getInstance(authenticatedAttributes);
this.digEncryptionAlgorithm = digEncryptionAlgorithm;
this.encryptedDigest = encryptedDigest;
this.unauthenticatedAttributes = ASN1Set.getInstance(unauthenticatedAttributes);
}
示例5: Attribute
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
private Attribute(
ASN1Sequence seq)
{
if (seq.size() != 2)
{
throw new IllegalArgumentException("Bad sequence size: " + seq.size());
}
attrType = ASN1ObjectIdentifier.getInstance(seq.getObjectAt(0));
attrValues = ASN1Set.getInstance(seq.getObjectAt(1));
}
示例6: DistributionPointName
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
public DistributionPointName(
ASN1TaggedObject obj)
{
this.type = obj.getTagNo();
if (type == 0)
{
this.name = GeneralNames.getInstance(obj, false);
}
else
{
this.name = ASN1Set.getInstance(obj, false);
}
}
示例7: SignerInfo
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
public SignerInfo(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
version = (ASN1Integer)e.nextElement();
issuerAndSerialNumber = IssuerAndSerialNumber.getInstance(e.nextElement());
digAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement());
Object obj = e.nextElement();
if (obj instanceof ASN1TaggedObject)
{
authenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)obj, false);
digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement());
}
else
{
authenticatedAttributes = null;
digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(obj);
}
encryptedDigest = DEROctetString.getInstance(e.nextElement());
if (e.hasMoreElements())
{
unauthenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)e.nextElement(), false);
}
else
{
unauthenticatedAttributes = null;
}
}
示例8: SignedData
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
public SignedData(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
version = (ASN1Integer)e.nextElement();
digestAlgorithms = ((ASN1Set)e.nextElement());
contentInfo = ContentInfo.getInstance(e.nextElement());
while (e.hasMoreElements())
{
ASN1Primitive o = (ASN1Primitive)e.nextElement();
//
// an interesting feature of SignedData is that there appear to be varying implementations...
// for the moment we ignore anything which doesn't fit.
//
if (o instanceof ASN1TaggedObject)
{
ASN1TaggedObject tagged = (ASN1TaggedObject)o;
switch (tagged.getTagNo())
{
case 0:
certificates = ASN1Set.getInstance(tagged, false);
break;
case 1:
crls = ASN1Set.getInstance(tagged, false);
break;
default:
throw new IllegalArgumentException("unknown tag value " + tagged.getTagNo());
}
}
else
{
signerInfos = (ASN1Set)o;
}
}
}
示例9: getInstance
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
public static Attributes getInstance(Object obj)
{
if (obj instanceof Attributes)
{
return (Attributes)obj;
}
else if (obj != null)
{
return new Attributes(ASN1Set.getInstance(obj));
}
return null;
}
示例10: CMSEnvelopedDataParser
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
public CMSEnvelopedDataParser(
InputStream envelopedData)
throws CMSException, IOException
{
super(envelopedData);
this.attrNotRead = true;
this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));
// TODO Validate version?
//DERInteger version = this._envelopedData.getVersion();
OriginatorInfo info = this.envelopedData.getOriginatorInfo();
if (info != null)
{
this.originatorInfo = new OriginatorInformation(info);
}
//
// read the recipients
//
ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());
//
// read the encrypted content info
//
EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
this.encAlg = encInfo.getContentEncryptionAlgorithm();
CMSReadable readable = new CMSProcessableInputStream(
((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
this.encAlg, readable);
//
// build the RecipientInformationStore
//
this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
recipientInfos, this.encAlg, secureReadable);
}
示例11: getInstance
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
public static RDN getInstance(Object obj)
{
if (obj instanceof RDN)
{
return (RDN)obj;
}
else if (obj != null)
{
return new RDN(ASN1Set.getInstance(obj));
}
return null;
}
示例12: getASN1Set
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
private static ASN1Set getASN1Set(
ASN1SetParser asn1SetParser)
{
return asn1SetParser == null
? null
: ASN1Set.getInstance(asn1SetParser.toASN1Primitive());
}
示例13: OriginatorInfo
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
private OriginatorInfo(
ASN1Sequence seq)
{
switch (seq.size())
{
case 0: // empty
break;
case 1:
ASN1TaggedObject o = (ASN1TaggedObject)seq.getObjectAt(0);
switch (o.getTagNo())
{
case 0 :
certs = ASN1Set.getInstance(o, false);
break;
case 1 :
crls = ASN1Set.getInstance(o, false);
break;
default:
throw new IllegalArgumentException("Bad tag in OriginatorInfo: " + o.getTagNo());
}
break;
case 2:
certs = ASN1Set.getInstance((ASN1TaggedObject)seq.getObjectAt(0), false);
crls = ASN1Set.getInstance((ASN1TaggedObject)seq.getObjectAt(1), false);
break;
default:
throw new IllegalArgumentException("OriginatorInfo too big");
}
}
示例14: SignedData
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
public SignedData(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
version = (DERInteger)e.nextElement();
digestAlgorithms = ((ASN1Set)e.nextElement());
contentInfo = ContentInfo.getInstance(e.nextElement());
while (e.hasMoreElements())
{
DERObject o = (DERObject)e.nextElement();
//
// an interesting feature of SignedData is that there appear to be varying implementations...
// for the moment we ignore anything which doesn't fit.
//
if (o instanceof DERTaggedObject)
{
DERTaggedObject tagged = (DERTaggedObject)o;
switch (tagged.getTagNo())
{
case 0:
certificates = ASN1Set.getInstance(tagged, false);
break;
case 1:
crls = ASN1Set.getInstance(tagged, false);
break;
default:
throw new IllegalArgumentException("unknown tag value " + tagged.getTagNo());
}
}
else
{
signerInfos = (ASN1Set)o;
}
}
}
示例15: X509Name
import org.bouncycastle.asn1.ASN1Set; //导入方法依赖的package包/类
/**
* Constructor from ASN1Sequence
*
* the principal will be a list of constructed sets, each containing an (OID, String) pair.
* @deprecated use X500Name.getInstance()
*/
public X509Name(
ASN1Sequence seq)
{
this.seq = seq;
Enumeration e = seq.getObjects();
while (e.hasMoreElements())
{
ASN1Set set = ASN1Set.getInstance(((ASN1Encodable)e.nextElement()).toASN1Primitive());
for (int i = 0; i < set.size(); i++)
{
ASN1Sequence s = ASN1Sequence.getInstance(set.getObjectAt(i).toASN1Primitive());
if (s.size() != 2)
{
throw new IllegalArgumentException("badly sized pair");
}
ordering.addElement(ASN1ObjectIdentifier.getInstance(s.getObjectAt(0)));
ASN1Encodable value = s.getObjectAt(1);
if (value instanceof ASN1String && !(value instanceof DERUniversalString))
{
String v = ((ASN1String)value).getString();
if (v.length() > 0 && v.charAt(0) == '#')
{
values.addElement("\\" + v);
}
else
{
values.addElement(v);
}
}
else
{
try
{
values.addElement("#" + bytesToString(Hex.encode(value.toASN1Primitive().getEncoded(ASN1Encoding.DER))));
}
catch (IOException e1)
{
throw new IllegalArgumentException("cannot encode value");
}
}
added.addElement((i != 0) ? TRUE : FALSE); // to allow earlier JDK compatibility
}
}
}