Excel VBAで、TripleDESによる暗号化と復号化処理をする方法を紹介します。
実装結果
以下のとおり、引数に引き渡した文字列を暗号化・復号化します。
※暗号化したバイト列は、BASE64符号化により文字列に変換しています。
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
'*************************************************************************************************** | |
'関数呼び出し | |
'*************************************************************************************************** | |
Sub 暗号化() | |
MsgBox "password -> " & EncryptStringTripleDES("password") | |
End Sub | |
Sub 復号化() | |
MsgBox "6pbpGQOC73TWEISe0qnwQA== -> " & DecryptStringTripleDES("6pbpGQOC73TWEISe0qnwQA==") | |
End Sub |
結果は、以下の通りです。
- 暗号化
- 復号化