protected override bool TryDecryptEcbCore( ReadOnlySpan <byte> ciphertext, Span <byte> destination, PaddingMode paddingMode, out int bytesWritten) { UniversalCryptoTransform transform = _core.CreateCryptoTransform( iv: null, encrypting: false, paddingMode, CipherMode.ECB); using (transform) { return(transform.TransformOneShot(ciphertext, destination, out bytesWritten)); } }
protected override bool TryEncryptEcbCore( ReadOnlySpan <byte> plaintext, Span <byte> destination, PaddingMode paddingMode, out int bytesWritten) { UniversalCryptoTransform transform = _core.CreateCryptoTransform( iv: null, encrypting: true, paddingMode, CipherMode.ECB, feedbackSizeInBits: 0); using (transform) { return(transform.TransformOneShot(plaintext, destination, out bytesWritten)); } }
protected override bool TryEncryptCbcCore( ReadOnlySpan <byte> plaintext, ReadOnlySpan <byte> iv, Span <byte> destination, PaddingMode paddingMode, out int bytesWritten) { UniversalCryptoTransform transform = _core.CreateCryptoTransform( iv: iv.ToArray(), encrypting: true, paddingMode, CipherMode.CBC); using (transform) { return(transform.TransformOneShot(plaintext, destination, out bytesWritten)); } }
protected override bool TryDecryptCbcCore( ReadOnlySpan <byte> ciphertext, ReadOnlySpan <byte> iv, Span <byte> destination, PaddingMode paddingMode, out int bytesWritten) { UniversalCryptoTransform transform = _core.CreateCryptoTransform( iv: iv.ToArray(), encrypting: false, paddingMode, CipherMode.CBC, feedbackSizeInBits: 0); using (transform) { return(transform.TransformOneShot(ciphertext, destination, out bytesWritten)); } }