本文整理汇总了C#中Asn1EncodableVector类的典型用法代码示例。如果您正苦于以下问题:C# Asn1EncodableVector类的具体用法?C# Asn1EncodableVector怎么用?C# Asn1EncodableVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Asn1EncodableVector类属于命名空间,在下文中一共展示了Asn1EncodableVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateAttributeCertificateInfo
public AttributeCertificateInfo GenerateAttributeCertificateInfo()
{
if ((serialNumber == null) || (signature == null)
|| (issuer == null) || (startDate == null) || (endDate == null)
|| (holder == null) || (attributes == null))
{
throw new InvalidOperationException("not all mandatory fields set in V2 AttributeCertificateInfo generator");
}
Asn1EncodableVector v = new Asn1EncodableVector(
version, holder, issuer, signature, serialNumber);
//
// before and after dates => AttCertValidityPeriod
//
v.Add(new AttCertValidityPeriod(startDate, endDate));
// Attributes
v.Add(new DerSequence(attributes));
if (issuerUniqueID != null)
{
v.Add(issuerUniqueID);
}
if (extensions != null)
{
v.Add(extensions);
}
return AttributeCertificateInfo.GetInstance(new DerSequence(v));
}
示例2: X9FieldID
/**
* Constructor for elliptic curves over binary fields
* <code>F<sub>2<sup>m</sup></sub></code>.
* @param m The exponent <code>m</code> of
* <code>F<sub>2<sup>m</sup></sub></code>.
* @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> +
* x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
* represents the reduction polynomial <code>f(z)</code>.
* @param k2 The integer <code>k2</code> where <code>x<sup>m</sup> +
* x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
* represents the reduction polynomial <code>f(z)</code>.
* @param k3 The integer <code>k3</code> where <code>x<sup>m</sup> +
* x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
* represents the reduction polynomial <code>f(z)</code>..
*/
public X9FieldID(
int m,
int k1,
int k2,
int k3)
{
this.id = X9ObjectIdentifiers.CharacteristicTwoField;
Asn1EncodableVector fieldIdParams = new Asn1EncodableVector(new DerInteger(m));
if (k2 == 0)
{
fieldIdParams.Add(
X9ObjectIdentifiers.TPBasis,
new DerInteger(k1));
}
else
{
fieldIdParams.Add(
X9ObjectIdentifiers.PPBasis,
new DerSequence(
new DerInteger(k1),
new DerInteger(k2),
new DerInteger(k3)));
}
this.parameters = new DerSequence(fieldIdParams);
}
示例3: X9FieldID
/**
* Constructor for elliptic curves over binary fields
* <code>F<sub>2<sup>m</sup></sub></code>.
* @param m The exponent <code>m</code> of
* <code>F<sub>2<sup>m</sup></sub></code>.
* @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> +
* x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
* represents the reduction polynomial <code>f(z)</code>.
* @param k2 The integer <code>k2</code> where <code>x<sup>m</sup> +
* x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
* represents the reduction polynomial <code>f(z)</code>.
* @param k3 The integer <code>k3</code> where <code>x<sup>m</sup> +
* x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
* represents the reduction polynomial <code>f(z)</code>..
*/
public X9FieldID(
int m,
int k1,
int k2,
int k3)
{
this.id = X9ObjectIdentifiers.CharacteristicTwoField;
Asn1EncodableVector fieldIdParams = new Asn1EncodableVector(new DerInteger(m));
if(k2 == 0)
{
if(k3 != 0)
throw new ArgumentException("inconsistent k values");
fieldIdParams.Add(
X9ObjectIdentifiers.TPBasis,
new DerInteger(k1));
}
else
{
if(k2 <= k1 || k3 <= k2)
throw new ArgumentException("inconsistent k values");
fieldIdParams.Add(
X9ObjectIdentifiers.PPBasis,
new DerSequence(
new DerInteger(k1),
new DerInteger(k2),
new DerInteger(k3)));
}
this.parameters = new DerSequence(fieldIdParams);
}
示例4: AddOptional
private void AddOptional(Asn1EncodableVector v, int tagNo, Asn1Encodable obj)
{
if (obj != null)
{
v.Add(new DerTaggedObject(true, tagNo, obj));
}
}
示例5: ConvertVector
private static Asn1EncodableVector ConvertVector(IList numbers)
{
Asn1EncodableVector av = new Asn1EncodableVector();
foreach (object o in numbers)
{
DerInteger di;
if (o is BigInteger)
{
di = new DerInteger((BigInteger)o);
}
else if (o is int)
{
di = new DerInteger((int)o);
}
else
{
throw new ArgumentException();
}
av.Add(di);
}
return av;
}
示例6: ToAsn1Object
/**
* <pre>
* Challenge ::= SEQUENCE {
* owf AlgorithmIdentifier OPTIONAL,
*
* -- MUST be present in the first Challenge; MAY be omitted in
* -- any subsequent Challenge in POPODecKeyChallContent (if
* -- omitted, then the owf used in the immediately preceding
* -- Challenge is to be used).
*
* witness OCTET STRING,
* -- the result of applying the one-way function (owf) to a
* -- randomly-generated INTEGER, A. [Note that a different
* -- INTEGER MUST be used for each Challenge.]
* challenge OCTET STRING
* -- the encryption (under the public key for which the cert.
* -- request is being made) of Rand, where Rand is specified as
* -- Rand ::= SEQUENCE {
* -- int INTEGER,
* -- - the randomly-generated INTEGER A (above)
* -- sender GeneralName
* -- - the sender's name (as included in PKIHeader)
* -- }
* }
* </pre>
* @return a basic ASN.1 object representation.
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector();
v.AddOptional(owf);
v.Add(witness);
v.Add(challenge);
return new DerSequence(v);
}
示例7: ToAsn1Object
/**
* <pre>
* OobCertHash ::= SEQUENCE {
* hashAlg [0] AlgorithmIdentifier OPTIONAL,
* certId [1] CertId OPTIONAL,
* hashVal BIT STRING
* -- hashVal is calculated over the Der encoding of the
* -- self-signed certificate with the identifier certID.
* }
* </pre>
* @return a basic ASN.1 object representation.
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector();
AddOptional(v, 0, hashAlg);
AddOptional(v, 1, certId);
v.Add(hashVal);
return new DerSequence(v);
}
示例8: ToAsn1Object
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* ContentInfo ::= Sequence {
* contentType ContentType,
* content
* [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(contentType);
if (content != null)
{
v.Add(new BerTaggedObject(0, content));
}
return new BerSequence(v);
}
示例9: ToAsn1Object
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* RevokedInfo ::= Sequence {
* revocationTime GeneralizedTime,
* revocationReason [0] EXPLICIT CRLReason OPTIONAL }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(revocationTime);
if (revocationReason != null)
{
v.Add(new DerTaggedObject(true, 0, revocationReason));
}
return new DerSequence(v);
}
示例10: ToAsn1Object
/**
* <pre>
* EncryptedData ::= SEQUENCE {
* version CMSVersion,
* encryptedContentInfo EncryptedContentInfo,
* unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
* </pre>
* @return a basic ASN.1 object representation.
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(version, encryptedContentInfo);
if (unprotectedAttrs != null)
{
v.Add(new BerTaggedObject(false, 1, unprotectedAttrs));
}
return new BerSequence(v);
}
示例11: AttributeTable
public AttributeTable(Asn1EncodableVector v)
{
_attributes = Platform.CreateHashtable(v.Count);
for (int i = 0; i != v.Count; i++)
{
AttributeX509 a = AttributeX509.GetInstance(v[i]);
_attributes.Add(a.AttrType, a);
}
}
示例12: ToAsn1Object
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* OcspRequest ::= Sequence {
* tbsRequest TBSRequest,
* optionalSignature [0] EXPLICIT Signature OPTIONAL }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(tbsRequest);
if (optionalSignature != null)
{
v.Add(new DerTaggedObject(true, 0, optionalSignature));
}
return new DerSequence(v);
}
示例13: ToAsn1Object
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* OcspResponse ::= Sequence {
* responseStatus OcspResponseStatus,
* responseBytes [0] EXPLICIT ResponseBytes OPTIONAL }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(responseStatus);
if (responseBytes != null)
{
v.Add(new DerTaggedObject(true, 0, responseBytes));
}
return new DerSequence(v);
}
示例14: ToAsn1Object
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector seq = new Asn1EncodableVector(qcStatementId);
if (qcStatementInfo != null)
{
seq.Add(qcStatementInfo);
}
return new DerSequence(seq);
}
示例15: ToAsn1Object
/**
* <pre>
* CommitmentTypeIndication ::= SEQUENCE {
* commitmentTypeId CommitmentTypeIdentifier,
* commitmentTypeQualifier SEQUENCE SIZE (1..MAX) OF
* CommitmentTypeQualifier OPTIONAL }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(commitmentTypeId);
if (commitmentTypeQualifier != null)
{
v.Add(commitmentTypeQualifier);
}
return new DerSequence(v);
}