public PbeS2Parameters(
            Asn1Sequence seq)
        {
			if (seq.Count != 2)
				throw new ArgumentException("Wrong number of elements in sequence", "seq");

			Asn1Sequence funcSeq = (Asn1Sequence)seq[0].ToAsn1Object();

			// TODO Not sure if this special case is really necessary/appropriate
			if (funcSeq[0].Equals(PkcsObjectIdentifiers.IdPbkdf2))
            {
				func = new KeyDerivationFunc(PkcsObjectIdentifiers.IdPbkdf2,
					Pbkdf2Params.GetInstance(funcSeq[1]));
			}
            else
            {
                func = new KeyDerivationFunc(funcSeq);
            }

			scheme = EncryptionScheme.GetInstance(seq[1].ToAsn1Object());
        }
Beispiel #2
0
        public PbeS2Parameters(
            Asn1Sequence seq)
        {
            if (seq.Count != 2)
            {
                throw new ArgumentException("Wrong number of elements in sequence", "seq");
            }

            Asn1Sequence funcSeq = (Asn1Sequence)seq[0].ToAsn1Object();

            // TODO Not sure if this special case is really necessary/appropriate
            if (funcSeq[0].Equals(PkcsObjectIdentifiers.IdPbkdf2))
            {
                func = new KeyDerivationFunc(PkcsObjectIdentifiers.IdPbkdf2,
                                             Pbkdf2Params.GetInstance(funcSeq[1]));
            }
            else
            {
                func = new KeyDerivationFunc(funcSeq);
            }

            scheme = EncryptionScheme.GetInstance(seq[1].ToAsn1Object());
        }