本文整理汇总了C#中Org.BouncyCastle.Asn1.X509.AlgorithmIdentifier类的典型用法代码示例。如果您正苦于以下问题:C# AlgorithmIdentifier类的具体用法?C# AlgorithmIdentifier怎么用?C# AlgorithmIdentifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlgorithmIdentifier类属于Org.BouncyCastle.Asn1.X509命名空间,在下文中一共展示了AlgorithmIdentifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KeyTransRecipientInformation
// private new AlgorithmIdentifier _encAlg;
public KeyTransRecipientInformation(
KeyTransRecipientInfo info,
AlgorithmIdentifier encAlg,
Stream data)
: base(encAlg, AlgorithmIdentifier.GetInstance(info.KeyEncryptionAlgorithm), data)
{
this._info = info;
// this._encAlg = encAlg;
this._rid = new RecipientID();
RecipientIdentifier r = info.RecipientIdentifier;
try
{
if (r.IsTagged)
{
Asn1OctetString octs = Asn1OctetString.GetInstance(r.ID);
_rid.SubjectKeyIdentifier = octs.GetOctets();
}
else
{
IssuerAndSerialNumber iAnds = IssuerAndSerialNumber.GetInstance(r.ID);
_rid.Issuer = iAnds.Name;
_rid.SerialNumber = iAnds.SerialNumber.Value;
}
}
catch (IOException)
{
throw new ArgumentException("invalid rid in KeyTransRecipientInformation");
}
}
示例2: PKMacValue
/**
* Creates a new PKMACValue.
* @param aid CMPObjectIdentifiers.passwordBasedMAC, with PBMParameter
* @param value MAC of the DER-encoded SubjectPublicKeyInfo
*/
public PKMacValue(
AlgorithmIdentifier algID,
DerBitString macValue)
{
this.algID = algID;
this.macValue = macValue;
}
示例3: RecipientInformation
internal RecipientInformation(
AlgorithmIdentifier keyEncAlg,
CmsSecureReadable secureReadable)
{
this.keyEncAlg = keyEncAlg;
this.secureReadable = secureReadable;
}
示例4: SubjectPublicKeyInfo
public SubjectPublicKeyInfo(
AlgorithmIdentifier algID,
byte[] publicKey)
{
this.keyData = new DerBitString(publicKey);
this.algID = algID;
}
示例5: 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;
}
示例6: RsaesOaepParameters
public RsaesOaepParameters(
Asn1Sequence seq)
{
hashAlgorithm = DefaultHashAlgorithm;
maskGenAlgorithm = DefaultMaskGenFunction;
pSourceAlgorithm = DefaultPSourceAlgorithm;
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:
pSourceAlgorithm = AlgorithmIdentifier.GetInstance(o, true);
break;
default:
throw new ArgumentException("unknown tag");
}
}
}
示例7: 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");
}
}
}
示例8: Generate
public TimeStampRequest Generate(
string digestAlgorithmOid,
byte[] digest,
BigInteger nonce)
{
if (digestAlgorithmOid == null)
{
throw new ArgumentException("No digest algorithm specified");
}
DerObjectIdentifier digestAlgOid = new DerObjectIdentifier(digestAlgorithmOid);
AlgorithmIdentifier algID = new AlgorithmIdentifier(digestAlgOid, DerNull.Instance);
MessageImprint messageImprint = new MessageImprint(algID, digest);
X509Extensions ext = null;
if (extOrdering.Count != 0)
{
ext = new X509Extensions(extOrdering, extensions);
}
DerInteger derNonce = nonce == null
? null
: new DerInteger(nonce);
return new TimeStampRequest(
new TimeStampReq(messageImprint, reqPolicy, derNonce, certReq, ext));
}
示例9: EssCertIDv2
private EssCertIDv2(
Asn1Sequence seq)
{
if (seq.Count != 2 && seq.Count != 3)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
int count = 0;
if (seq[0] is Asn1OctetString)
{
// Default value
this.hashAlgorithm = DefaultAlgID;
}
else
{
this.hashAlgorithm = AlgorithmIdentifier.GetInstance(seq[count++].ToAsn1Object());
}
this.certHash = Asn1OctetString.GetInstance(seq[count++].ToAsn1Object()).GetOctets();
if (seq.Count > count)
{
this.issuerSerial = IssuerSerial.GetInstance(
Asn1Sequence.GetInstance(seq[count].ToAsn1Object()));
}
}
示例10: 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);
}
}
示例11: LdsSecurityObject
private LdsSecurityObject(
Asn1Sequence seq)
{
if (seq == null || seq.Count == 0)
throw new ArgumentException("null or empty sequence passed.");
IEnumerator e = seq.GetEnumerator();
// version
e.MoveNext();
version = DerInteger.GetInstance(e.Current);
// digestAlgorithmIdentifier
e.MoveNext();
digestAlgorithmIdentifier = AlgorithmIdentifier.GetInstance(e.Current);
e.MoveNext();
Asn1Sequence datagroupHashSeq = Asn1Sequence.GetInstance(e.Current);
if (version.Value.Equals(BigInteger.One))
{
e.MoveNext();
versionInfo = LdsVersionInfo.GetInstance(e.Current);
}
CheckDatagroupHashSeqSize(datagroupHashSeq.Count);
datagroupHash = new DataGroupHash[datagroupHashSeq.Count];
for (int i= 0; i< datagroupHashSeq.Count; i++)
{
datagroupHash[i] = DataGroupHash.GetInstance(datagroupHashSeq[i]);
}
}
示例12: RsaDigestSigner
public RsaDigestSigner(
IDigest digest)
{
this.digest = digest;
algId = new AlgorithmIdentifier( (DerObjectIdentifier)oidMap[digest.AlgorithmName] , DerNull.Instance);
}
示例13: PbmParameter
private PbmParameter(Asn1Sequence seq)
{
salt = Asn1OctetString.GetInstance(seq[0]);
owf = AlgorithmIdentifier.GetInstance(seq[1]);
iterationCount = DerInteger.GetInstance(seq[2]);
mac = AlgorithmIdentifier.GetInstance(seq[3]);
}
示例14: PerformTest
public override void PerformTest()
{
AlgorithmIdentifier algId = new AlgorithmIdentifier(new DerObjectIdentifier("1.2.2.3"));
byte[] digest = new byte[20];
OtherHash otherHash = new OtherHash(
new OtherHashAlgAndValue(algId, digest));
OtherCertID otherCertID = new OtherCertID(otherHash);
OtherSigningCertificate otherCert = new OtherSigningCertificate(otherCertID);
checkConstruction(otherCert, otherCertID);
otherCert = OtherSigningCertificate.GetInstance(null);
if (otherCert != null)
{
Fail("null GetInstance() failed.");
}
try
{
OtherCertID.GetInstance(new Object());
Fail("GetInstance() failed to detect bad object.");
}
catch (ArgumentException)
{
// expected
}
}
示例15: Generate
public RecipientInfo Generate(KeyParameter contentEncryptionKey, SecureRandom random)
{
byte[] keyBytes = contentEncryptionKey.GetKey();
string rfc3211WrapperName = Helper.GetRfc3211WrapperName(keyEncryptionKeyOID);
IWrapper keyWrapper = Helper.CreateWrapper(rfc3211WrapperName);
// Note: In Java build, the IV is automatically generated in JCE layer
int ivLength = Platform.StartsWith(rfc3211WrapperName, "DESEDE") ? 8 : 16;
byte[] iv = new byte[ivLength];
random.NextBytes(iv);
ICipherParameters parameters = new ParametersWithIV(keyEncryptionKey, iv);
keyWrapper.Init(true, new ParametersWithRandom(parameters, random));
Asn1OctetString encryptedKey = new DerOctetString(
keyWrapper.Wrap(keyBytes, 0, keyBytes.Length));
DerSequence seq = new DerSequence(
new DerObjectIdentifier(keyEncryptionKeyOID),
new DerOctetString(iv));
AlgorithmIdentifier keyEncryptionAlgorithm = new AlgorithmIdentifier(
PkcsObjectIdentifiers.IdAlgPwriKek, seq);
return new RecipientInfo(new PasswordRecipientInfo(
keyDerivationAlgorithm, keyEncryptionAlgorithm, encryptedKey));
}