vb.net - read from an encrypted file into strings -


i have custom settings file in plain text, file read , each line represents variable setting. below file contains

online 19x.13x.xx.1xx location spec col storage path

i can encrypt file , put on users machines, don't want them make changes or read on file

i can decrypt file onto disc, don't want that, need use values in memory.

here have write decrypted file (something found online )

    public function decrypt(byval b() byte, byval psw string) byte()      ' generates key password     dim pdb system.security.cryptography.passwordderivebytes = new system.security.cryptography.passwordderivebytes(psw, new byte() {1, 2, 3, 4, 5, 6, 7, 8, 9, 10})      ' holds encrypted      dim ms system.io.memorystream = new system.io.memorystream()      ' object holds information aes encryption     dim aese system.security.cryptography.aes = new system.security.cryptography.aesmanaged()     aese.key = pdb.getbytes(aese.keysize / 8)     aese.iv = pdb.getbytes(aese.blocksize / 8)      ' decrypt data     dim cs system.security.cryptography.cryptostream = new system.security.cryptography.cryptostream(ms, aese.createdecryptor(), system.security.cryptography.cryptostreammode.write)     cs.write(b, 0, b.length)     cs.close()     return ms.toarray() end function 

i need read each line , assign variables. thank-you in advance


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -