File Encryption Library for .NET.

I am looking for a file encryption library in .NET. It should be able to search , so CryptoStream is out of the question. (I know that it inherits the Seek method, but it is not implemented.)

I need to search because my application is processing large files in the wrong order. I also have to read and write files at the same time .

I know that most of the time CBC is used to encrypt files, but searching (and writing) is not possible with it. But somehow, complete disk encryption software, for example TrueCrypt and BitLocker, managed to use it in this way. (Edit: TrueCrypt no longer uses CBC, they moved to LRW , then to XTS . I can say that this is possible.)

This is a hobby project, so I'm interested in free libraries. It also doesn't matter if it only supports .NET 4.

Edit : Bouncy Castle is not very good, because CipherStream cannot search in the same way as .NET CryptoStream.

+3
source share
3 answers

One option might be a bouncy castle, which is free:

http://www.bouncycastle.org/csharp/

I am not sure how you want to search in your project. But at least some features work around the search problems:

"X509CertificateParser / X509CrlParser now processes multiple certificates / CRLs in streams that do not support search"

+1
source

Searching in CBC is not possible - in fact, CBC mode is trivially searchable. To decrypt block i, you need to know the key, the encrypted block C_i and the previous encrypted block C_i-1. You, of course, do not need to decrypt the entire previous stream.

0
source

AES, XTS . , TrueCrypt. XTS .

An easy way is to use Threefish: this is a custom block cipher, so you can simply use the block index as a setting and then encrypt the data as an ECB. The disadvantage is that Threefish is not standard. This should be relatively easy to implement.

0
source

Source: https://habr.com/ru/post/1713667/


All Articles