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