本文整理汇总了C#中Org.BouncyCastle.Asn1.Asn1EncodableVector类的典型用法代码示例。如果您正苦于以下问题:C# Asn1EncodableVector类的具体用法?C# Asn1EncodableVector怎么用?C# Asn1EncodableVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Asn1EncodableVector类属于Org.BouncyCastle.Asn1命名空间,在下文中一共展示了Asn1EncodableVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: toASN1Primitive
public Asn1Object toASN1Primitive()
{
Asn1EncodableVector dev = new Asn1EncodableVector();
dev.Add(this.sigPolicyQualifierId);
dev.Add(this.sigQualifier);
return new DerSequence(dev);
}
示例2: DerSequence
/**
* create a sequence containing a vector of objects.
*/
public DerSequence(
Asn1EncodableVector v)
: base(v.Count)
{
foreach (Asn1Encodable ae in v)
{
AddObject(ae);
}
}
示例3: CreateBerSetFromList
public static Asn1Set CreateBerSetFromList(List<Asn1Encodable> derObjects)
{
Asn1EncodableVector v = new Asn1EncodableVector();
foreach (Asn1Encodable d in derObjects)
{
v.Add(d);
}
return new BerSet(v);
}
示例4: WriteTo
/// <summary>
/// Write myself to the given stream
/// </summary>
public void WriteTo(Stream stream, out string md5FingerPrint, out string sha1FingerPrint)
{
X509Certificate[] cert;
AsymmetricKeyEntry privateKey;
LoadPfx(out cert, out privateKey);
var certsVector = new Asn1EncodableVector();
md5FingerPrint = null;
sha1FingerPrint = null;
foreach (var c in cert)
{
var certStream = new MemoryStream(c.GetEncoded());
var certStruct = X509CertificateStructure.GetInstance(new Asn1InputStream(certStream).ReadObject());
certsVector.Add(certStruct);
if (md5FingerPrint == null)
{
var certData = certStream.ToArray();
md5FingerPrint = CreateFingerprint(new MD5Digest(), certData);
}
if (sha1FingerPrint == null)
{
var certData = certStream.ToArray();
sha1FingerPrint = CreateFingerprint(new Sha1Digest(), certData);
}
}
var encryptedSignature = GetSignature(signature, privateKey.Key);
var signerInfo = new SignerInfo(
new DerInteger(1),
new IssuerAndSerialNumber(cert[0].IssuerDN, cert[0].SerialNumber),
new AlgorithmIdentifier(Oids.SHA1, DerNull.Instance),
null,
new AlgorithmIdentifier(Oids.RSA, DerNull.Instance),
new DerOctetString(encryptedSignature),
null);
var pkcs7 = new SignedData(
new DerInteger(1),
new DerSet(new AlgorithmIdentifier(Oids.SHA1, DerNull.Instance)),
new ContentInfo(new DerObjectIdentifier(Oids.data), null),
new DerSet(certsVector),
null,
new DerSet(signerInfo));
//var signedData = new ContentInfo(new DERObjectIdentifier(Oids.signedData), pkcs7);
var v = new Asn1EncodableVector();
v.Add(new DerObjectIdentifier(Oids.signedData));
v.Add(new DerTaggedObject(0, pkcs7));
var signedData = new DerSequence(v);
// Save
var data = signedData.GetEncoded();
stream.Write(data, 0, data.Length);
}
示例5: FromEnumerable
public static Asn1EncodableVector FromEnumerable(
IEnumerable e)
{
Asn1EncodableVector v = new Asn1EncodableVector();
foreach (Asn1Encodable obj in e)
{
v.Add(obj);
}
return v;
}
示例6: ToAsn1Object
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector seq = new Asn1EncodableVector(qcStatementId);
if (qcStatementInfo != null)
{
seq.Add(qcStatementInfo);
}
return new DerSequence(seq);
}
示例7: ToAsn1Object
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(p, g);
if (this.l != null)
{
v.Add(l);
}
return new DerSequence(v);
}
示例8: ToAsn1Object
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* Request ::= Sequence {
* reqCert CertID,
* singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(reqCert);
if (singleRequestExtensions != null)
{
v.Add(new DerTaggedObject(true, 0, singleRequestExtensions));
}
return new DerSequence(v);
}
示例9: 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);
}
示例10: 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);
}
示例11: ToAsn1Object
/**
* <pre>
* MacData ::= SEQUENCE {
* mac DigestInfo,
* macSalt OCTET STRING,
* iterations INTEGER DEFAULT 1
* -- Note: The default is for historic reasons and its use is deprecated. A
* -- higher value, like 1024 is recommended.
* </pre>
* @return the basic DERObject construction.
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(digInfo, new DerOctetString(salt));
if (!iterationCount.Equals(BigInteger.One))
{
v.Add(new DerInteger(iterationCount));
}
return new DerSequence(v);
}
示例12: 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);
}
示例13: ToAsn1Object
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* ServiceLocator ::= Sequence {
* issuer Name,
* locator AuthorityInfoAccessSyntax OPTIONAL }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(issuer);
if (locator != null)
{
v.Add(locator);
}
return new DerSequence(v);
}
示例14: 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);
}
示例15: ToAsn1Object
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* IDEA-CBCPar ::= Sequence {
* iv OCTET STRING OPTIONAL -- exactly 8 octets
* }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector();
if (iv != null)
{
v.Add(iv);
}
return new DerSequence(v);
}