<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" />

BcTlsCcmImpl

using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Modes; using System; namespace Org.BouncyCastle.Tls.Crypto.Impl.BC { internal class BcTlsCcmImpl : BcTlsAeadCipherImpl { internal BcTlsCcmImpl(CcmBlockCipher cipher, bool isEncrypting) : base(cipher, isEncrypting) { } public override int DoFinal(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) { CcmBlockCipher ccmBlockCipher = m_cipher as CcmBlockCipher; if (ccmBlockCipher != null) try { return ccmBlockCipher.ProcessPacket(input, inputOffset, inputLength, output, outputOffset); } catch (InvalidCipherTextException alertCause) { throw new TlsFatalAlert(20, alertCause); } throw new InvalidOperationException(); } } }