public Pkcs12PbeParams( byte[] salt, int iterations) { this.iv = new DerOctetString(salt); this.iterations = new DerInteger(iterations); }
public RC2CbcParameter( int parameterVersion, byte[] iv) { this.version = new DerInteger(parameterVersion); this.iv = new DerOctetString(iv); }
public Cast5CbcParameters( byte[] iv, int keyLength) { this.iv = new DerOctetString(iv); this.keyLength = new DerInteger(keyLength); }
public RecipientKeyIdentifier( Asn1Sequence seq) { subjectKeyIdentifier = Asn1OctetString.GetInstance( seq[0]); switch(seq.Count) { case 1: break; case 2: if (seq[1] is DerGeneralizedTime) { date = (DerGeneralizedTime) seq[1]; } else { other = OtherKeyAttribute.GetInstance(seq[2]); } break; case 3: date = (DerGeneralizedTime) seq[1]; other = OtherKeyAttribute.GetInstance(seq[2]); break; default: throw new ArgumentException("Invalid RecipientKeyIdentifier"); } }
public DataGroupHash( int dataGroupNumber, Asn1OctetString dataGroupHashValue) { this.dataGroupNumber = new DerInteger(dataGroupNumber); this.dataGroupHashValue = dataGroupHashValue; }
public PbeParameter( byte[] salt, int iterationCount) { this.octStr = new DerOctetString(salt); this.iterationCount = new DerInteger(iterationCount); }
public KeyAgreeRecipientInformation( KeyAgreeRecipientInfo info, AlgorithmIdentifier encAlg, Stream data) : base(encAlg, AlgorithmIdentifier.GetInstance(info.KeyEncryptionAlgorithm), data) { _info = info; // _encAlg = encAlg; try { Asn1Sequence s = _info.RecipientEncryptedKeys; RecipientEncryptedKey id = RecipientEncryptedKey.GetInstance(s[0]); Asn1.Cms.IssuerAndSerialNumber iAnds = id.Identifier.IssuerAndSerialNumber; // byte[] issuerBytes = iAnds.Name.GetEncoded(); _rid = new RecipientID(); // _rid.SetIssuer(issuerBytes); _rid.Issuer = iAnds.Name; _rid.SerialNumber = iAnds.SerialNumber.Value; _encryptedKey = id.EncryptedKey; } catch (IOException e) { throw new ArgumentException("invalid rid in KeyAgreeRecipientInformation", e); } }
public KeyTransRecipientInfo( Asn1Sequence seq) { this.version = (DerInteger) seq[0]; this.rid = RecipientIdentifier.GetInstance(seq[1]); this.keyEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[2]); this.encryptedKey = (Asn1OctetString) seq[3]; }
private IdeaCbcPar( Asn1Sequence seq) { if (seq.Count == 1) { iv = (Asn1OctetString) seq[0]; } }
public KekRecipientInfo( Asn1Sequence seq) { version = (DerInteger) seq[0]; kekID = KekIdentifier.GetInstance(seq[1]); keyEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[2]); encryptedKey = (Asn1OctetString) seq[3]; }
public PasswordRecipientInfo( AlgorithmIdentifier keyEncryptionAlgorithm, Asn1OctetString encryptedKey) { this.version = new DerInteger(0); this.keyEncryptionAlgorithm = keyEncryptionAlgorithm; this.encryptedKey = encryptedKey; }
private PbeParameter(Asn1Sequence seq) { if (seq.Count != 2) throw new ArgumentException("Wrong number of elements in sequence", "seq"); salt = Asn1OctetString.GetInstance(seq[0]); iterationCount = DerInteger.GetInstance(seq[1]); }
public ResponderID( Asn1OctetString id) { if (id == null) throw new ArgumentNullException("id"); this.id = id; }
private Cast5CbcParameters( Asn1Sequence seq) { if (seq.Count != 2) throw new ArgumentException("Wrong number of elements in sequence", "seq"); iv = (Asn1OctetString) seq[0]; keyLength = (DerInteger) seq[1]; }
public RecipientKeyIdentifier( Asn1OctetString subjectKeyIdentifier, DerGeneralizedTime date, OtherKeyAttribute other) { this.subjectKeyIdentifier = subjectKeyIdentifier; this.date = date; this.other = other; }
public KekIdentifier( byte[] keyIdentifier, DerGeneralizedTime date, OtherKeyAttribute other) { this.keyIdentifier = new DerOctetString(keyIdentifier); this.date = date; this.other = other; }
private ResponseBytes( Asn1Sequence seq) { if (seq.Count != 2) throw new ArgumentException("Wrong number of elements in sequence", "seq"); this.responseType = DerObjectIdentifier.GetInstance(seq[0]); this.response = Asn1OctetString.GetInstance(seq[1]); }
public EncryptedContentInfo( DerObjectIdentifier contentType, AlgorithmIdentifier contentEncryptionAlgorithm, Asn1OctetString encryptedContent) { this.contentType = contentType; this.contentEncryptionAlgorithm = contentEncryptionAlgorithm; this.encryptedContent = encryptedContent; }
private DataGroupHash( Asn1Sequence seq) { if (seq.Count != 2) throw new ArgumentException("Wrong number of elements in sequence", "seq"); this.dataGroupNumber = DerInteger.GetInstance(seq[0]); this.dataGroupHashValue = Asn1OctetString.GetInstance(seq[1]); }
public RecipientKeyIdentifier( byte[] subjectKeyIdentifier, DerGeneralizedTime date, OtherKeyAttribute other) { this.subjectKeyIdentifier = new DerOctetString(subjectKeyIdentifier); this.date = date; this.other = other; }
private Gost28147Parameters( Asn1Sequence seq) { if (seq.Count != 2) throw new ArgumentException("Wrong number of elements in sequence", "seq"); this.iv = Asn1OctetString.GetInstance(seq[0]); this.paramSet = DerObjectIdentifier.GetInstance(seq[1]); }
public KekRecipientInfo( KekIdentifier kekID, AlgorithmIdentifier keyEncryptionAlgorithm, Asn1OctetString encryptedKey) { this.version = new DerInteger(4); this.kekID = kekID; this.keyEncryptionAlgorithm = keyEncryptionAlgorithm; this.encryptedKey = encryptedKey; }
public BiometricData( TypeOfBiometricData typeOfBiometricData, AlgorithmIdentifier hashAlgorithm, Asn1OctetString biometricDataHash) { this.typeOfBiometricData = typeOfBiometricData; this.hashAlgorithm = hashAlgorithm; this.biometricDataHash = biometricDataHash; this.sourceDataUri = null; }
private CertID( Asn1Sequence seq) { if (seq.Count != 4) throw new ArgumentException("Wrong number of elements in sequence", "seq"); this.hashAlgorithm = AlgorithmIdentifier.GetInstance(seq[0]); this.issuerNameHash = Asn1OctetString.GetInstance(seq[1]); this.issuerKeyHash = Asn1OctetString.GetInstance(seq[2]); this.serialNumber = DerInteger.GetInstance(seq[3]); }
internal KeyAgreeRecipientInformation( KeyAgreeRecipientInfo info, RecipientID rid, Asn1OctetString encryptedKey, CmsSecureReadable secureReadable) : base(info.KeyEncryptionAlgorithm, secureReadable) { this.info = info; this.rid = rid; this.encryptedKey = encryptedKey; }
public CertID( AlgorithmIdentifier hashAlgorithm, Asn1OctetString issuerNameHash, Asn1OctetString issuerKeyHash, DerInteger serialNumber) { this.hashAlgorithm = hashAlgorithm; this.issuerNameHash = issuerNameHash; this.issuerKeyHash = issuerKeyHash; this.serialNumber = serialNumber; }
private static ICollection GetAlternativeName( Asn1OctetString extVal) { IList temp = Platform.CreateArrayList(); if (extVal != null) { try { Asn1Sequence seq = DerSequence.GetInstance(FromExtensionValue(extVal)); foreach (Asn1Encodable primName in seq) { IList list = Platform.CreateArrayList(); GeneralName genName = GeneralName.GetInstance(primName); list.Add(genName.TagNo); switch (genName.TagNo) { case GeneralName.EdiPartyName: case GeneralName.X400Address: case GeneralName.OtherName: list.Add(genName.Name.ToAsn1Object()); break; case GeneralName.DirectoryName: list.Add(X509Name.GetInstance(genName.Name).ToString()); break; case GeneralName.DnsName: case GeneralName.Rfc822Name: case GeneralName.UniformResourceIdentifier: list.Add(((IAsn1String)genName.Name).GetString()); break; case GeneralName.RegisteredID: list.Add(DerObjectIdentifier.GetInstance(genName.Name).Id); break; case GeneralName.IPAddress: list.Add(DerOctetString.GetInstance(genName.Name).GetOctets()); break; default: throw new IOException("Bad tag number: " + genName.TagNo); } temp.Add(list); } } catch (Exception e) { throw new CertificateParsingException(e.Message); } } return temp; }
/** * * Calulates the keyidentifier using a SHA1 hash over the BIT STRING * from SubjectPublicKeyInfo as defined in RFC2459. * * Example of making a AuthorityKeyIdentifier: * <pre> * SubjectPublicKeyInfo apki = new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream( * publicKey.getEncoded()).readObject()); * AuthorityKeyIdentifier aki = new AuthorityKeyIdentifier(apki); * </pre> * **/ public AuthorityKeyIdentifier( SubjectPublicKeyInfo spki) { IDigest digest = new Sha1Digest(); byte[] resBuf = new byte[digest.GetDigestSize()]; byte[] bytes = spki.PublicKeyData.GetBytes(); digest.BlockUpdate(bytes, 0, bytes.Length); digest.DoFinal(resBuf, 0); this.keyidentifier = new DerOctetString(resBuf); }
public EncryptedContentInfo( Asn1Sequence seq) { contentType = (DerObjectIdentifier) seq[0]; contentEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[1]); if (seq.Count > 2) { encryptedContent = Asn1OctetString.GetInstance( (Asn1TaggedObject) seq[2], false); } }
public ResponseBytes( DerObjectIdentifier responseType, Asn1OctetString response) { if (responseType == null) throw new ArgumentNullException("responseType"); if (response == null) throw new ArgumentNullException("response"); this.responseType = responseType; this.response = response; }