Esempio n. 1
0
        private static void AddCipher(int id, string name, int keySize, Func <SymmetricAlgorithm> cipherFactory)
        {
            var newCipher = new OpenPgpSymmetricCipher(id, name, () => { var sa = cipherFactory(); sa.KeySize = keySize; return(sa); });

            _IdToCipher[id]     = newCipher;
            _NameToCipher[name] = newCipher;
        }
Esempio n. 2
0
        public SymmetricKeyEncryptedSessionKeyOpenPgpPacket(OpenPgpPacketHeader header, Stream inputStream) : base(header, inputStream)
        {
            int versionNumber = inputStream.ReadByte();

            if (versionNumber != ExpectedVersion)
            {
                throw new InvalidDataException();
            }

            Cipher = OpenPgpSymmetricCipher.GetCipher(inputStream.ReadByte());
            StringToKeySpecifier = OpenPgpStringToKeySpecifier.ReadFrom(inputStream);

            if (inputStream.Position < StartOfNextPacketOffset)
            {
                throw new NotImplementedException();
            }
        }
Esempio n. 3
0
 public override byte[] HashToKey(SecureString passphrase, OpenPgpSymmetricCipher cipher)
 {
     return(HashAlgorithm.ComputeHash(Salt, passphrase, cipher.KeySizeInBits / 8, Count));
 }
Esempio n. 4
0
 public abstract byte[] HashToKey(SecureString passphrase, OpenPgpSymmetricCipher cipher);
Esempio n. 5
0
 public override byte[] HashToKey(SecureString passphrase, OpenPgpSymmetricCipher cipher)
 {
     return HashAlgorithm.ComputeHash(Salt, passphrase, cipher.KeySizeInBits / 8, Count);
 }
Esempio n. 6
0
 private static void AddCipher(int id, string name, int keySize, Func<SymmetricAlgorithm> cipherFactory)
 {
     var newCipher = new OpenPgpSymmetricCipher(id, name, () => { var sa = cipherFactory(); sa.KeySize = keySize; return sa; });
     _IdToCipher[id] = newCipher;
     _NameToCipher[name] = newCipher;
 }
Esempio n. 7
0
 public abstract byte[] HashToKey(SecureString passphrase, OpenPgpSymmetricCipher cipher);