本文整理汇总了C#中DerInteger类的典型用法代码示例。如果您正苦于以下问题:C# DerInteger类的具体用法?C# DerInteger怎么用?C# DerInteger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DerInteger类属于命名空间,在下文中一共展示了DerInteger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IssuerAndSerialNumber
public IssuerAndSerialNumber(
X509Name name,
BigInteger certSerialNumber)
{
this.name = name;
this.certSerialNumber = new DerInteger(certSerialNumber);
}
示例2: RsassaPssParameters
public RsassaPssParameters(
Asn1Sequence seq)
{
hashAlgorithm = DefaultHashAlgorithm;
maskGenAlgorithm = DefaultMaskGenFunction;
saltLength = DefaultSaltLength;
trailerField = DefaultTrailerField;
for (int i = 0; i != seq.Count; i++)
{
Asn1TaggedObject o = (Asn1TaggedObject)seq[i];
switch (o.TagNo)
{
case 0:
hashAlgorithm = AlgorithmIdentifier.GetInstance(o, true);
break;
case 1:
maskGenAlgorithm = AlgorithmIdentifier.GetInstance(o, true);
break;
case 2:
saltLength = DerInteger.GetInstance(o, true);
break;
case 3:
trailerField = DerInteger.GetInstance(o, true);
break;
default:
throw new ArgumentException("unknown tag");
}
}
}
示例3: RC2CbcParameter
public RC2CbcParameter(
int parameterVersion,
byte[] iv)
{
this.version = new DerInteger(parameterVersion);
this.iv = new DerOctetString(iv);
}
示例4: Pkcs12PbeParams
public Pkcs12PbeParams(
byte[] salt,
int iterations)
{
this.iv = new DerOctetString(salt);
this.iterations = new DerInteger(iterations);
}
示例5: Pbkdf2Params
public Pbkdf2Params(
Asn1Sequence seq)
{
if (seq.Count < 2 || seq.Count > 4)
throw new ArgumentException("Wrong number of elements in sequence", "seq");
this.octStr = (Asn1OctetString)seq[0];
this.iterationCount = (DerInteger)seq[1];
Asn1Encodable kl = null, d = null;
if (seq.Count > 3)
{
kl = seq[2];
d = seq[3];
}
else if (seq.Count > 2)
{
if (seq[2] is DerInteger)
{
kl = seq[2];
}
else
{
d = seq[2];
}
}
if (kl != null)
{
keyLength = (DerInteger)kl;
}
if (d != null)
{
prf = AlgorithmIdentifier.GetInstance(d);
}
}
示例6: 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;
}
示例7: CompressedData
public CompressedData(
Asn1Sequence seq)
{
this.version = (DerInteger) seq[0];
this.compressionAlgorithm = AlgorithmIdentifier.GetInstance(seq[1]);
this.encapContentInfo = ContentInfo.GetInstance(seq[2]);
}
示例8: CertResponse
private CertResponse(Asn1Sequence seq)
{
certReqId = DerInteger.GetInstance(seq[0]);
status = PkiStatusInfo.GetInstance(seq[1]);
if (seq.Count >= 3)
{
if (seq.Count == 3)
{
Asn1Encodable o = seq[2];
if (o is Asn1OctetString)
{
rspInfo = Asn1OctetString.GetInstance(o);
}
else
{
certifiedKeyPair = CertifiedKeyPair.GetInstance(o);
}
}
else
{
certifiedKeyPair = CertifiedKeyPair.GetInstance(seq[2]);
rspInfo = Asn1OctetString.GetInstance(seq[3]);
}
}
}
示例9: PerformTest
public override void PerformTest()
{
DerInteger val = new DerInteger(9);
DerApplicationSpecific tagged = new DerApplicationSpecific(false, 3, val);
if (!AreEqual(impData, tagged.GetEncoded()))
{
Fail("implicit encoding failed");
}
DerInteger recVal = (DerInteger) tagged.GetObject(Asn1Tags.Integer);
if (!val.Equals(recVal))
{
Fail("implicit read back failed");
}
DerApplicationSpecific certObj = (DerApplicationSpecific)
Asn1Object.FromByteArray(certData);
if (!certObj.IsConstructed() || certObj.ApplicationTag != 33)
{
Fail("parsing of certificate data failed");
}
byte[] encoded = certObj.GetDerEncoded();
if (!Arrays.AreEqual(certData, encoded))
{
Console.WriteLine(Encoding.ASCII.GetString(certData, 0, certData.Length).Substring(0, 20));
Console.WriteLine(Encoding.ASCII.GetString(encoded, 0, encoded.Length).Substring(0, 20));
Fail("re-encoding of certificate data failed");
}
}
示例10: AuthenticatedData
public AuthenticatedData(
OriginatorInfo originatorInfo,
Asn1Set recipientInfos,
AlgorithmIdentifier macAlgorithm,
AlgorithmIdentifier digestAlgorithm,
ContentInfo encapsulatedContent,
Asn1Set authAttrs,
Asn1OctetString mac,
Asn1Set unauthAttrs)
{
if (digestAlgorithm != null || authAttrs != null)
{
if (digestAlgorithm == null || authAttrs == null)
{
throw new ArgumentException("digestAlgorithm and authAttrs must be set together");
}
}
version = new DerInteger(CalculateVersion(originatorInfo));
this.originatorInfo = originatorInfo;
this.macAlgorithm = macAlgorithm;
this.digestAlgorithm = digestAlgorithm;
this.recipientInfos = recipientInfos;
this.encapsulatedContentInfo = encapsulatedContent;
this.authAttrs = authAttrs;
this.mac = mac;
this.unauthAttrs = unauthAttrs;
}
示例11: DHPublicKey
public DHPublicKey(DerInteger y)
{
if (y == null)
throw new ArgumentNullException("y");
this.y = y;
}
示例12: IssuerSerial
public IssuerSerial(
GeneralNames issuer,
DerInteger serial)
{
this.issuer = issuer;
this.serial = serial;
}
示例13: PkiStatusInfo
/**
* @param status
* @param statusString
*/
public PkiStatusInfo(
int status,
PkiFreeText statusString)
{
this.status = new DerInteger(status);
this.statusString = statusString;
}
示例14: GeneralSubtree
private GeneralSubtree(
Asn1Sequence seq)
{
baseName = GeneralName.GetInstance(seq[0]);
switch (seq.Count)
{
case 1:
break;
case 2:
{
Asn1TaggedObject o = Asn1TaggedObject.GetInstance(seq[1]);
switch (o.TagNo)
{
case 0:
minimum = DerInteger.GetInstance(o, false);
break;
case 1:
maximum = DerInteger.GetInstance(o, false);
break;
default:
throw new ArgumentException("Bad tag number: " + o.TagNo);
}
break;
}
case 3:
{
minimum = DerInteger.GetInstance(Asn1TaggedObject.GetInstance(seq[1]));
maximum = DerInteger.GetInstance(Asn1TaggedObject.GetInstance(seq[2]));
break;
}
default:
throw new ArgumentException("Bad sequence size: " + seq.Count);
}
}
示例15: TimeStampedDataParser
private TimeStampedDataParser(Asn1SequenceParser parser)
{
this.parser = parser;
this.version = DerInteger.GetInstance(parser.ReadObject());
Asn1Object obj = parser.ReadObject().ToAsn1Object();
if (obj is DerIA5String)
{
this.dataUri = DerIA5String.GetInstance(obj);
obj = parser.ReadObject().ToAsn1Object();
}
if (//obj is MetaData ||
obj is Asn1SequenceParser)
{
this.metaData = MetaData.GetInstance(obj.ToAsn1Object());
obj = parser.ReadObject().ToAsn1Object();
}
if (obj is Asn1OctetStringParser)
{
this.content = (Asn1OctetStringParser)obj;
}
}