Last active
December 31, 2015 12:48
-
-
Save kawakawa/7988362 to your computer and use it in GitHub Desktop.
AESの暗号記述
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (SymmetricAlgorithm cspAlgorithm = new AesManaged()) | |
{ | |
cspAlgorithm.Key = keyBytes | |
cspAlgorithm.IV = ivBytes | |
using (ICryptoTransform encryptor = cspAlgorithm.CreateEncryptor()) | |
{ | |
byte[] source = Encoding.UTF8.GetBytes(暗号化させたい文章); | |
byte[] encrypted = encryptor.TransformFinalBlock(source, 0, source.Length); | |
Base64変換された暗号化された文章= Convert.ToBase64String(encrypted); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment