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