Just checking with moderators to make sure we can help you with a decrypting question.
Sub Button1_Click()
Set objEnc = CreateObject("CAPICOM.EncryptedData.1")
Set objHash = CreateObject("CAPICOM.HashedData.1")
objHash.Algorithm = CAPICOM_HASH_ALGORITHM_SHA_256
strHashData = Range("A1")
objHash.Hash strHashData
strHash = objHash.Value
Range("C2").Value = strHash
objEnc.Algorithm = CAPICOM_ENCRYPTION_ALGORITHM_AES
objEnc.Algorithm.KeyLength = CAPICOM_ENCRYPTION_KEY_LENGTH_256_BITS
objEnc.SetSecret strHash
objEnc.Content = Range("B1")
strEncrptedText = objEnc.Encrypt
Range("C1").Value = strEncrptedText
Range("C3").Value = "Hashed with: " & objHash.Algorithm
Range("C4").Value = "Encrypted with: " & objEnc.Algorithm
Range("C5").Value = "Key length: " & objEnc.Algorithm.KeyLength
End Sub
Sub Button2_Click()
Set objDec = CreateObject("CAPICOM.EncryptedData.1")
Set objHash = CreateObject("CAPICOM.HashedData.1")
objHash.Algorithm = CAPICOM_HASH_ALGORITHM_SHA_256
strHashData = Range("A1")
objHash.Hash strHashData
strHash = objHash.Value
objDec.Algorithm = CAPICOM_ENCRYPTION_ALGORITHM_AES
objDec.Algorithm.KeyLength = CAPICOM_ENCRYPTION_KEY_LENGTH_256_BITS
objDec.SetSecret strHash
strText = Range("C1")
objDec.Decrypt strText
Range("D1").Value = objDec.Content
End Sub
Title | # Comments | Views | Activity |
---|---|---|---|
excel file | 5 | 44 | |
Input box prompt to specify column letter using VBA | 4 | 13 | |
Excel | 3 | 20 | |
Populate data based on a criteria | 2 | 13 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
10 Experts available now in Live!