- 암호화 모듈
https://msdn.microsoft.com/ko-kr/library/system.security.cryptography.rijndaelmanaged(v=vs.110).aspx
Rijndael 알고리즘을 이용한 암호화 처리.
byte[]로 되어 있는 rijndael.Key, rijndael.IV를 키로 사용하여 암호화, 복호화를 진행한다.
using System.Security.Cryptography; private static readonly int KEYSIZE = 128; private static readonly int BLOCKSIZE = 128; private readonly RijndaelManaged rijndael = new RijndaelManaged(); rijndael.Mode = CipherMode.CBC; rijndael.Padding = PaddingMode.PKCS7; rijndael.KeySize = KEYSIZE; rijndael.BlockSize = BLOCKSIZE; // 복호화 public byte[] decrypt(byte[] inputBuffer) { return rijndael.CreateDecryptor().TransformFinalBlock(inputBuffer, 0, inputBuffer.Length); } // 암호화 public byte[] encrypt(byte[] inputBuffer) { return rijndael.CreateEncryptor().TransformFinalBlock(inputBuffer, 0, inputBuffer.Length); }
댓글 없음:
댓글 쓰기