Inheritance: Asn1Encodable
Exemplo n.º 1
0
        public PbeS2Parameters(Asn1Sequence seq)
        {
            if (seq.Count != 2)
            {
                throw new ArgumentException("Wrong number of elements in sequence", "seq");
            }
            Asn1Sequence asn1Sequence = (Asn1Sequence)seq[0].ToAsn1Object();

            if (asn1Sequence[0].Equals(PkcsObjectIdentifiers.IdPbkdf2))
            {
                this.func = new KeyDerivationFunc(PkcsObjectIdentifiers.IdPbkdf2, Pbkdf2Params.GetInstance(asn1Sequence[1]));
            }
            else
            {
                this.func = new KeyDerivationFunc(asn1Sequence);
            }
            this.scheme = EncryptionScheme.GetInstance(seq[1].ToAsn1Object());
        }
Exemplo n.º 2
0
        public PbeS2Parameters(Asn1Sequence seq)
        {
            //IL_0019: Unknown result type (might be due to invalid IL or missing references)
            if (seq.Count != 2)
            {
                throw new ArgumentException("Wrong number of elements in sequence", "seq");
            }
            Asn1Sequence asn1Sequence = (Asn1Sequence)seq[0].ToAsn1Object();

            if (asn1Sequence[0].Equals(PkcsObjectIdentifiers.IdPbkdf2))
            {
                func = new KeyDerivationFunc(PkcsObjectIdentifiers.IdPbkdf2, Pbkdf2Params.GetInstance(asn1Sequence[1]));
            }
            else
            {
                func = new KeyDerivationFunc(asn1Sequence);
            }
            scheme = EncryptionScheme.GetInstance(seq[1].ToAsn1Object());
        }
Exemplo n.º 3
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());
        }
Exemplo n.º 4
0
		public void AddPasswordRecipient(
			CmsPbeKey	pbeKey,
			string		kekAlgorithmOid)
		{
			Pbkdf2Params p = new Pbkdf2Params(pbeKey.Salt, pbeKey.IterationCount);

			PasswordRecipientInfoGenerator prig = new PasswordRecipientInfoGenerator();
			prig.KeyDerivationAlgorithm = new AlgorithmIdentifier(PkcsObjectIdentifiers.IdPbkdf2, p);
			prig.KeyEncryptionKeyOID = kekAlgorithmOid;
			prig.KeyEncryptionKey = pbeKey.GetEncoded(kekAlgorithmOid);

			recipientInfoGenerators.Add(prig);
		}
Exemplo n.º 5
0
		public void AddPasswordRecipient(
			CmsPbeKey	pbeKey,
			string		kekAlgorithmOid)
		{
			Pbkdf2Params p = new Pbkdf2Params(pbeKey.Salt, pbeKey.IterationCount);
			KeyParameter secretKey = pbeKey.GetEncoded(kekAlgorithmOid);
			recipientInfs.Add(new RecipientInf(kekAlgorithmOid, secretKey, new AlgorithmIdentifier(PkcsObjectIdentifiers.IdPbkdf2, p)));
		}