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