本文整理汇总了C#中Asn1Object类的典型用法代码示例。如果您正苦于以下问题:C# Asn1Object类的具体用法?C# Asn1Object怎么用?C# Asn1Object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Asn1Object类属于命名空间,在下文中一共展示了Asn1Object类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SigPolicyQualifierInfo
public SigPolicyQualifierInfo(
DerObjectIdentifier sigPolicyQualifierId,
Asn1Encodable sigQualifier)
{
this.sigPolicyQualifierId = sigPolicyQualifierId;
this.sigQualifier = sigQualifier.ToAsn1Object();
}
示例2: PrivateKeyInfo
private PrivateKeyInfo(
Asn1Sequence seq)
{
IEnumerator e = seq.GetEnumerator();
e.MoveNext();
IBigInteger version = ((DerInteger) e.Current).Value;
if (version.IntValue != 0)
{
throw new ArgumentException("wrong version for private key info");
}
e.MoveNext();
algID = AlgorithmIdentifier.GetInstance(e.Current);
try
{
e.MoveNext();
Asn1OctetString data = (Asn1OctetString) e.Current;
privKey = Asn1Object.FromByteArray(data.GetOctets());
}
catch (IOException)
{
throw new ArgumentException("Error recoverying private key from sequence");
}
if (e.MoveNext())
{
attributes = Asn1Set.GetInstance((Asn1TaggedObject) e.Current, false);
}
}
示例3: GeneralName
/**
* When the subjectAltName extension contains an Internet mail address,
* the address MUST be included as an rfc822Name. The format of an
* rfc822Name is an "addr-spec" as defined in RFC 822 [RFC 822].
*
* When the subjectAltName extension contains a domain name service
* label, the domain name MUST be stored in the dNSName (an IA5String).
* The name MUST be in the "preferred name syntax," as specified by RFC
* 1034 [RFC 1034].
*
* When the subjectAltName extension contains a URI, the name MUST be
* stored in the uniformResourceIdentifier (an IA5String). The name MUST
* be a non-relative URL, and MUST follow the URL syntax and encoding
* rules specified in [RFC 1738]. The name must include both a scheme
* (e.g., "http" or "ftp") and a scheme-specific-part. The scheme-
* specific-part must include a fully qualified domain name or IP
* address as the host.
*
* When the subjectAltName extension contains a iPAddress, the address
* MUST be stored in the octet string in "network byte order," as
* specified in RFC 791 [RFC 791]. The least significant bit (LSB) of
* each octet is the LSB of the corresponding byte in the network
* address. For IP Version 4, as specified in RFC 791, the octet string
* MUST contain exactly four octets. For IP Version 6, as specified in
* RFC 1883, the octet string MUST contain exactly sixteen octets [RFC
* 1883].
*/
public GeneralName(
Asn1Object name,
int tag)
{
this.obj = name;
this.tag = tag;
}
示例4: CertBag
public CertBag(
DerObjectIdentifier certID,
Asn1Object certValue)
{
this.certID = certID;
this.certValue = certValue;
}
示例5: PrivateKeyInfo
public PrivateKeyInfo(
AlgorithmIdentifier algID,
Asn1Object privateKey,
Asn1Set attributes)
{
this.algID = algID;
this.privKey = new DerOctetString(privateKey.GetEncoded(Asn1Encodable.Der));
this.attributes = attributes;
}
示例6: ServiceLocator
private ServiceLocator(
Asn1Sequence seq)
{
this.issuer = X509Name.GetInstance(seq[0]);
if (seq.Count > 1)
{
this.locator = seq[1].ToAsn1Object();
}
}
示例7: Time
public Time(
Asn1Object time)
{
if (time == null)
throw new ArgumentNullException("time");
if (!(time is DerUtcTime) && !(time is DerGeneralizedTime))
throw new ArgumentException("unknown object passed to Time");
this.time = time;
}
示例8: OtherRevRefs
private OtherRevRefs(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count != 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.otherRevRefType = (DerObjectIdentifier) seq[0].ToAsn1Object();
this.otherRevRefs = seq[1].ToAsn1Object();
}
示例9: CommitmentTypeQualifier
/**
* Creates a new <code>CommitmentTypeQualifier</code> instance.
*
* @param commitmentTypeIdentifier a <code>CommitmentTypeIdentifier</code> value
* @param qualifier the qualifier, defined by the above field.
*/
public CommitmentTypeQualifier(
DerObjectIdentifier commitmentTypeIdentifier,
Asn1Encodable qualifier)
{
if (commitmentTypeIdentifier == null)
throw new ArgumentNullException("commitmentTypeIdentifier");
this.commitmentTypeIdentifier = commitmentTypeIdentifier;
if (qualifier != null)
{
this.qualifier = qualifier.ToAsn1Object();
}
}
示例10: X9FieldID
private X9FieldID(Asn1Sequence seq)
{
this.id = DerObjectIdentifier.GetInstance(seq[0]);
this.parameters = seq[1].ToAsn1Object();
}
示例11: AsString
/**
* dump a Der object as a formatted string with indentation
*
* @param obj the Asn1Object to be dumped out.
*/
private static string AsString(
string indent,
Asn1Object obj)
{
if (obj is Asn1Sequence)
{
StringBuilder Buffer = new StringBuilder();
string tab = indent + TAB;
Buffer.Append(indent);
if (obj is DerSequence)
{
Buffer.Append("DER Sequence");
}
else if (obj is BerSequence)
{
Buffer.Append("BER Sequence");
}
else
{
Buffer.Append("Sequence");
}
Buffer.Append(
// MASC 20070308. CF compatibility patch
#if !NETCF
Environment.NewLine
#else
EnvironmentEx.NewLine
#endif
);
foreach (object o in ((Asn1Sequence)obj))
{
if (o == null || o.Equals(DerNull.Instance))
{
Buffer.Append(tab);
Buffer.Append("Null");
Buffer.Append(
// MASC 20070308. CF compatibility patch
#if !NETCF
Environment.NewLine
#else
EnvironmentEx.NewLine
#endif
);
}
else if (o is Asn1Object)
{
Buffer.Append(AsString(tab, (Asn1Object)o));
}
else
{
Buffer.Append(AsString(tab, ((Asn1Encodable)o).ToAsn1Object()));
}
}
return Buffer.ToString();
}
else if (obj is DerTaggedObject)
{
StringBuilder Buffer = new StringBuilder();
string tab = indent + TAB;
Buffer.Append(indent);
if (obj is BerTaggedObject)
{
Buffer.Append("BER Tagged [");
}
else
{
Buffer.Append("Tagged [");
}
DerTaggedObject o = (DerTaggedObject)obj;
Buffer.Append(((int)o.TagNo).ToString());
Buffer.Append(']');
if (!o.IsExplicit())
{
Buffer.Append(" IMPLICIT ");
}
Buffer.Append(
// MASC 20070308. CF compatibility patch
#if !NETCF
Environment.NewLine
#else
EnvironmentEx.NewLine
#endif
);
if (o.IsEmpty())
{
Buffer.Append(tab);
//.........这里部分代码省略.........
示例12: AsString
/**
* dump a Der object as a formatted string with indentation
*
* @param obj the Asn1Object to be dumped out.
*/
private static void AsString(
string indent,
bool verbose,
Asn1Object obj,
StringBuilder buf)
{
if (obj is Asn1Sequence)
{
string tab = indent + Tab;
buf.Append(indent);
if (obj is BerSequence)
{
buf.Append("BER Sequence");
}
else if (obj is DerSequence)
{
buf.Append("DER Sequence");
}
else
{
buf.Append("Sequence");
}
buf.Append(NewLine);
foreach (Asn1Encodable o in ((Asn1Sequence)obj))
{
if (o == null || o is Asn1Null)
{
buf.Append(tab);
buf.Append("NULL");
buf.Append(NewLine);
}
else
{
AsString(tab, verbose, o.ToAsn1Object(), buf);
}
}
}
else if (obj is DerTaggedObject)
{
string tab = indent + Tab;
buf.Append(indent);
if (obj is BerTaggedObject)
{
buf.Append("BER Tagged [");
}
else
{
buf.Append("Tagged [");
}
DerTaggedObject o = (DerTaggedObject)obj;
buf.Append(((int)o.TagNo).ToString());
buf.Append(']');
if (!o.IsExplicit())
{
buf.Append(" IMPLICIT ");
}
buf.Append(NewLine);
if (o.IsEmpty())
{
buf.Append(tab);
buf.Append("EMPTY");
buf.Append(NewLine);
}
else
{
AsString(tab, verbose, o.GetObject(), buf);
}
}
else if (obj is BerSet)
{
string tab = indent + Tab;
buf.Append(indent);
buf.Append("BER Set");
buf.Append(NewLine);
foreach (Asn1Encodable o in ((Asn1Set)obj))
{
if (o == null)
{
buf.Append(tab);
buf.Append("NULL");
buf.Append(NewLine);
}
else
{
AsString(tab, verbose, o.ToAsn1Object(), buf);
}
//.........这里部分代码省略.........
示例13: OriginatorIdentifierOrKey
public OriginatorIdentifierOrKey(
Asn1Object id)
{
this.id = id;
}
示例14: AsString
/**
* dump a Der object as a formatted string with indentation
*
* @param obj the Asn1Object to be dumped out.
*/
private static string AsString(
string indent,
bool verbose,
Asn1Object obj)
{
if (obj is Asn1Sequence)
{
StringBuilder buf = new StringBuilder(indent);
string tab = indent + Tab;
if (obj is BerSequence)
{
buf.Append("BER Sequence");
}
else if (obj is DerSequence)
{
buf.Append("DER Sequence");
}
else
{
buf.Append("Sequence");
}
buf.Append(NewLine);
foreach (Asn1Encodable o in ((Asn1Sequence)obj))
{
if (o == null || o is Asn1Null)
{
buf.Append(tab);
buf.Append("NULL");
buf.Append(NewLine);
}
else
{
buf.Append(AsString(tab, verbose, o.ToAsn1Object()));
}
}
return buf.ToString();
}
else if (obj is DerTaggedObject)
{
StringBuilder buf = new StringBuilder();
string tab = indent + Tab;
buf.Append(indent);
if (obj is BerTaggedObject)
{
buf.Append("BER Tagged [");
}
else
{
buf.Append("Tagged [");
}
DerTaggedObject o = (DerTaggedObject)obj;
buf.Append(((int)o.TagNo).ToString());
buf.Append(']');
if (!o.IsExplicit())
{
buf.Append(" IMPLICIT ");
}
buf.Append(NewLine);
if (o.IsEmpty())
{
buf.Append(tab);
buf.Append("EMPTY");
buf.Append(NewLine);
}
else
{
buf.Append(AsString(tab, verbose, o.GetObject()));
}
return buf.ToString();
}
else if (obj is BerSet)
{
StringBuilder buf = new StringBuilder();
string tab = indent + Tab;
buf.Append(indent);
buf.Append("BER Set");
buf.Append(NewLine);
foreach (Asn1Encodable o in ((Asn1Set)obj))
{
if (o == null)
{
buf.Append(tab);
//.........这里部分代码省略.........
示例15: RecipientIdentifier
public RecipientIdentifier(
Asn1Object id)
{
this.id = id;
}