本文整理汇总了C#中Org.BouncyCastle.Asn1.Asn1Sequence类的典型用法代码示例。如果您正苦于以下问题:C# Asn1Sequence类的具体用法?C# Asn1Sequence怎么用?C# Asn1Sequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Asn1Sequence类属于Org.BouncyCastle.Asn1命名空间,在下文中一共展示了Asn1Sequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompressedData
public CompressedData(
Asn1Sequence seq)
{
this.version = (DerInteger) seq[0];
this.compressionAlgorithm = AlgorithmIdentifier.GetInstance(seq[1]);
this.encapContentInfo = ContentInfo.GetInstance(seq[2]);
}
示例2: LdsSecurityObject
private LdsSecurityObject(
Asn1Sequence seq)
{
if (seq == null || seq.Count == 0)
throw new ArgumentException("null or empty sequence passed.");
IEnumerator e = seq.GetEnumerator();
// version
e.MoveNext();
version = DerInteger.GetInstance(e.Current);
// digestAlgorithmIdentifier
e.MoveNext();
digestAlgorithmIdentifier = AlgorithmIdentifier.GetInstance(e.Current);
e.MoveNext();
Asn1Sequence datagroupHashSeq = Asn1Sequence.GetInstance(e.Current);
if (version.Value.Equals(BigInteger.One))
{
e.MoveNext();
versionInfo = LdsVersionInfo.GetInstance(e.Current);
}
CheckDatagroupHashSeqSize(datagroupHashSeq.Count);
datagroupHash = new DataGroupHash[datagroupHashSeq.Count];
for (int i= 0; i< datagroupHashSeq.Count; i++)
{
datagroupHash[i] = DataGroupHash.GetInstance(datagroupHashSeq[i]);
}
}
示例3: SignerLocation
public SignerLocation(
DerUtf8String countryName,
DerUtf8String localityName,
Asn1Sequence postalAddress)
{
if (postalAddress != null && postalAddress.Count > 6)
{
throw new ArgumentException("postal address must contain less than 6 strings");
}
if (countryName != null)
{
this.countryName = DerUtf8String.GetInstance(countryName.ToAsn1Object());
}
if (localityName != null)
{
this.localityName = DerUtf8String.GetInstance(localityName.ToAsn1Object());
}
if (postalAddress != null)
{
this.postalAddress = (Asn1Sequence) postalAddress.ToAsn1Object();
}
}
示例4: SignerLocation
public SignerLocation(
Asn1Sequence seq)
{
foreach (DerTaggedObject o in seq)
{
switch (o.TagNo)
{
case 0:
this.countryName = DerUtf8String.GetInstance(o, true);
break;
case 1:
this.localityName = DerUtf8String.GetInstance(o, true);
break;
case 2:
bool isExplicit = o.IsExplicit(); // handle erroneous implicitly tagged sequences
this.postalAddress = Asn1Sequence.GetInstance(o, isExplicit);
if (postalAddress != null && postalAddress.Count > 6)
{
throw new ArgumentException("postal address must contain less than 6 strings");
}
break;
default:
throw new ArgumentException("illegal tag");
}
}
}
示例5: OriginatorInfo
public OriginatorInfo(
Asn1Sequence seq)
{
switch (seq.Count)
{
case 0: // empty
break;
case 1:
Asn1TaggedObject o = (Asn1TaggedObject) seq[0];
switch (o.TagNo)
{
case 0 :
certs = Asn1Set.GetInstance(o, false);
break;
case 1 :
crls = Asn1Set.GetInstance(o, false);
break;
default:
throw new ArgumentException("Bad tag in OriginatorInfo: " + o.TagNo);
}
break;
case 2:
certs = Asn1Set.GetInstance((Asn1TaggedObject) seq[0], false);
crls = Asn1Set.GetInstance((Asn1TaggedObject) seq[1], false);
break;
default:
throw new ArgumentException("OriginatorInfo too big");
}
}
示例6: SemanticsInformation
public SemanticsInformation(
Asn1Sequence seq)
{
if (seq.Count < 1)
{
throw new ArgumentException("no objects in SemanticsInformation");
}
IEnumerator e = seq.GetEnumerator();
e.MoveNext();
object obj = e.Current;
if (obj is DerObjectIdentifier)
{
semanticsIdentifier = DerObjectIdentifier.GetInstance(obj);
if (e.MoveNext())
{
obj = e.Current;
}
else
{
obj = null;
}
}
if (obj != null)
{
Asn1Sequence generalNameSeq = Asn1Sequence.GetInstance(obj );
nameRegistrationAuthorities = new GeneralName[generalNameSeq.Count];
for (int i= 0; i < generalNameSeq.Count; i++)
{
nameRegistrationAuthorities[i] = GeneralName.GetInstance(generalNameSeq[i]);
}
}
}
示例7: AttributeCertificateInfo
private AttributeCertificateInfo(
Asn1Sequence seq)
{
if (seq.Count < 7 || seq.Count > 9)
{
throw new ArgumentException("Bad sequence size: " + seq.Count);
}
this.version = DerInteger.GetInstance(seq[0]);
this.holder = Holder.GetInstance(seq[1]);
this.issuer = AttCertIssuer.GetInstance(seq[2]);
this.signature = AlgorithmIdentifier.GetInstance(seq[3]);
this.serialNumber = DerInteger.GetInstance(seq[4]);
this.attrCertValidityPeriod = AttCertValidityPeriod.GetInstance(seq[5]);
this.attributes = Asn1Sequence.GetInstance(seq[6]);
for (int i = 7; i < seq.Count; i++)
{
Asn1Encodable obj = (Asn1Encodable) seq[i];
if (obj is DerBitString)
{
this.issuerUniqueID = DerBitString.GetInstance(seq[i]);
}
else if (obj is Asn1Sequence || obj is X509Extensions)
{
this.extensions = X509Extensions.GetInstance(seq[i]);
}
}
}
示例8: RecipientKeyIdentifier
public RecipientKeyIdentifier(
Asn1Sequence seq)
{
subjectKeyIdentifier = Asn1OctetString.GetInstance(
seq[0]);
switch(seq.Count)
{
case 1:
break;
case 2:
if (seq[1] is DerGeneralizedTime)
{
date = (DerGeneralizedTime) seq[1];
}
else
{
other = OtherKeyAttribute.GetInstance(seq[2]);
}
break;
case 3:
date = (DerGeneralizedTime) seq[1];
other = OtherKeyAttribute.GetInstance(seq[2]);
break;
default:
throw new ArgumentException("Invalid RecipientKeyIdentifier");
}
}
示例9: CheckPermittedDN
private void CheckPermittedDN(ISet permitted, Asn1Sequence dns)
//throws PkixNameConstraintValidatorException
{
if (permitted == null)
{
return;
}
if ((permitted.Count == 0) && dns.Count == 0)
{
return;
}
IEnumerator it = permitted.GetEnumerator();
while (it.MoveNext())
{
Asn1Sequence subtree = (Asn1Sequence)it.Current;
if (WithinDNSubtree(dns, subtree))
{
return;
}
}
throw new PkixNameConstraintValidatorException(
"Subject distinguished name is not from a permitted subtree");
}
示例10: SingleResponse
public SingleResponse(
Asn1Sequence seq)
{
this.certID = CertID.GetInstance(seq[0]);
this.certStatus = CertStatus.GetInstance(seq[1]);
this.thisUpdate = (DerGeneralizedTime)seq[2];
if (seq.Count > 4)
{
this.nextUpdate = DerGeneralizedTime.GetInstance(
(Asn1TaggedObject) seq[3], true);
this.singleExtensions = X509Extensions.GetInstance(
(Asn1TaggedObject) seq[4], true);
}
else if (seq.Count > 3)
{
Asn1TaggedObject o = (Asn1TaggedObject) seq[3];
if (o.TagNo == 0)
{
this.nextUpdate = DerGeneralizedTime.GetInstance(o, true);
}
else
{
this.singleExtensions = X509Extensions.GetInstance(o, true);
}
}
}
示例11: EncryptionScheme
internal EncryptionScheme(
Asn1Sequence seq)
: base(seq)
{
objectID = (Asn1Object) seq[0];
obj = (Asn1Object) seq[1];
}
示例12: CommitmentTypeIndication
public CommitmentTypeIndication(
DerObjectIdentifier commitmentTypeId,
Asn1Sequence commitmentTypeQualifier)
{
this.commitmentTypeId = commitmentTypeId;
this.commitmentTypeQualifier = commitmentTypeQualifier;
}
示例13: IdeaCbcPar
private IdeaCbcPar(
Asn1Sequence seq)
{
if (seq.Count == 1)
{
iv = (Asn1OctetString) seq[0];
}
}
示例14: KekRecipientInfo
public KekRecipientInfo(
Asn1Sequence seq)
{
version = (DerInteger) seq[0];
kekID = KekIdentifier.GetInstance(seq[1]);
keyEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[2]);
encryptedKey = (Asn1OctetString) seq[3];
}
示例15: KeyTransRecipientInfo
public KeyTransRecipientInfo(
Asn1Sequence seq)
{
this.version = (DerInteger) seq[0];
this.rid = RecipientIdentifier.GetInstance(seq[1]);
this.keyEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[2]);
this.encryptedKey = (Asn1OctetString) seq[3];
}