Beispiel #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;
        }
Beispiel #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();
            }
        }
Beispiel #3
0
 public override byte[] HashToKey(SecureString passphrase, OpenPgpSymmetricCipher cipher)
 {
     return(HashAlgorithm.ComputeHash(Salt, passphrase, cipher.KeySizeInBits / 8, Count));
 }
Beispiel #4
0
 public abstract byte[] HashToKey(SecureString passphrase, OpenPgpSymmetricCipher cipher);
Beispiel #5
0
 public override byte[] HashToKey(SecureString passphrase, OpenPgpSymmetricCipher cipher)
 {
     return HashAlgorithm.ComputeHash(Salt, passphrase, cipher.KeySizeInBits / 8, Count);
 }
Beispiel #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;
 }
Beispiel #7
0
 public abstract byte[] HashToKey(SecureString passphrase, OpenPgpSymmetricCipher cipher);