Skip to content

Instantly share code, notes, and snippets.

@kawakawa
Last active December 31, 2015 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawakawa/7988362 to your computer and use it in GitHub Desktop.
Save kawakawa/7988362 to your computer and use it in GitHub Desktop.
AESの暗号記述
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