You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for AEAD AES 128/256 GCM Ciphers (.NET 6.0 onward only) (#1369)
* Init AeadCipher
* Move AeadCipher to parent folder. Move EncryptBlock/DecryptBlock from SymmetricCipher to BlockCipher
* simplify parameter name
* Implement AesGcmCipher
* Update README
* Remove protected IV from AeadCipher; Set offset to outbound sequence just like other ciphers
* Rename associatedData to packetLengthField
* Use Span<byte> to avoid unnecessary allocations
* Use `Span` to improve performance when `IncrementCounter()`
* Add `IsAead` property to `CipherInfo`. Include packet length field and tag field in offset and length when call AesGcm's `Decrypt(...)` method. Do not determine HMAC if cipher is AesGcm during kex.
* Fix build
* Fix UT
* Check `AesGcm.IsSupported` before add to the `Encryptions` collection.
Guard AES-GCM with `NET6_0_OR_GREATER`.
Insert AES-GCM ciphers right after AES-CTR ciphers but before AES-CBC ciphers, which is similar with OpenSSH:
```
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
```
Although Dictionary's order is not defined, from observation, it is in the same order with add. Anyway that would be another topic.
* Suppress CA1859 "Use concrete types when possible for improved performance" for `ConnectionInfo.Encryptions`.
Test `Aes128Gcm` and `Aes256Gcm` only when `NET6_0_OR_GREATER`
* Update xml doc comments. Do not treat AesGcmCipher separately in Session.cs
* Fix build
* Fix build
* Update the comment as ChaCha20Poly1305 uses a separated key to encypt the packet length and the size it 4.
* Update src/Renci.SshNet/Security/Cryptography/Cipher.cs
Co-authored-by: Rob Hague <[email protected]>
* Make `AesGcmCipher` internal.
Assert offset when decrypt.
* Fix nullable error in build
* typos
---------
Co-authored-by: Rob Hague <[email protected]>
0 commit comments