protected override bool TryDecryptCfbCore( ReadOnlySpan <byte> ciphertext, ReadOnlySpan <byte> iv, Span <byte> destination, PaddingMode paddingMode, int feedbackSizeInBits, out int bytesWritten) { ValidateCFBFeedbackSize(feedbackSizeInBits); ILiteSymmetricCipher cipher = CreateLiteCipher( CipherMode.CFB, paddingMode, Key, iv, blockSize: BlockSize / BitsPerByte, feedbackSizeInBits / BitsPerByte, paddingSize: feedbackSizeInBits / BitsPerByte, encrypting: false); using (cipher) { return(UniversalCryptoOneShot.OneShotDecrypt(cipher, paddingMode, ciphertext, destination, out bytesWritten)); } }
protected override bool TryDecryptEcbCore( ReadOnlySpan <byte> ciphertext, Span <byte> destination, PaddingMode paddingMode, out int bytesWritten) { if (!ValidKeySize(Key.Length, out int keySize)) { throw new InvalidOperationException(SR.Cryptography_InvalidKeySize); } Debug.Assert(EffectiveKeySize == KeySize); ILiteSymmetricCipher cipher = CreateLiteCipher( CipherMode.ECB, paddingMode, Key, iv: null, blockSize: BlockSize / BitsPerByte, 0, /*feedback size */ paddingSize: BlockSize / BitsPerByte, encrypting: false); using (cipher) { return(UniversalCryptoOneShot.OneShotDecrypt(cipher, paddingMode, ciphertext, destination, out bytesWritten)); } }
protected override bool TryDecryptEcbCore( ReadOnlySpan <byte> ciphertext, Span <byte> destination, PaddingMode paddingMode, out int bytesWritten) { ILiteSymmetricCipher cipher = CreateLiteCipher( CipherMode.ECB, paddingMode, Key, iv: null, blockSize: BlockSize / BitsPerByte, 0, /*feedback size */ paddingSize: BlockSize / BitsPerByte, encrypting: false); using (cipher) { return(UniversalCryptoOneShot.OneShotDecrypt(cipher, paddingMode, ciphertext, destination, out bytesWritten)); } }