本文整理匯總了C#中Org.BouncyCastle.Asn1.DerOutputStream.Dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# DerOutputStream.Dispose方法的具體用法?C# DerOutputStream.Dispose怎麽用?C# DerOutputStream.Dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Org.BouncyCastle.Asn1.DerOutputStream
的用法示例。
在下文中一共展示了DerOutputStream.Dispose方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Encode
/*
* A note on the implementation:
* <p>
* As Der requires the constructed, definite-length model to
* be used for structured types, this varies slightly from the
* ASN.1 descriptions given. Rather than just outputing Sequence,
* we also have to specify Constructed, and the objects length.
*/
internal override void Encode(
DerOutputStream derOut)
{
// TODO Intermediate buffer could be avoided if we could calculate expected length
MemoryStream bOut = new MemoryStream();
DerOutputStream dOut = new DerOutputStream(bOut);
foreach (Asn1Encodable obj in this)
{
dOut.WriteObject(obj);
}
dOut.Dispose();
byte[] bytes = bOut.ToArray();
derOut.WriteEncoded(Asn1Tags.Sequence | Asn1Tags.Constructed, bytes);
}
示例2: Encode
internal override void Encode(
DerOutputStream derOut)
{
OidTokenizer tok = new OidTokenizer(identifier);
MemoryStream bOut = new MemoryStream();
DerOutputStream dOut = new DerOutputStream(bOut);
string token = tok.NextToken();
int first = int.Parse(token);
token = tok.NextToken();
int second = int.Parse(token);
WriteField(bOut, first * 40 + second);
while (tok.HasMoreTokens)
{
token = tok.NextToken();
if (token.Length < 18)
{
WriteField(bOut, Int64.Parse(token));
}
else
{
WriteField(bOut, new BigInteger(token));
}
}
dOut.Dispose();
derOut.WriteEncoded(Asn1Tags.ObjectIdentifier, bOut.ToArray());
}