The developers of the external application provided me the following
information for verification purposes --
Unencoded String: prodProducerID
Key: p9r8688
Encrypted String: MTAwMjg6cHJvZFByb2R1Y2VySUQ6MTQ
I tried encoding the string and got a completely different result.
--------------------
Dim myEncoder
Set myEncoder = Server.CreateObject("CAPICOM.EncryptedData.1")
myEncoder.SetSecret("p9r8688")
myEncoder.Content = "prodProducerID"
Response.Write "The encrypted string is <BR><B>" + myEncoder.Encrypt()
+ "</B>"
--------------------
The output was:
MGoGCSsGAQQBgjdYA6BdMFsGCisGAQQBgjdYAwGgTTBLAgMCAAACAmYCAgIAgAQI
Pz8ylwBOw2MEENsET3V1ObwGwvnjZqYDgZYEIGgSoptbdq8KwiswDqh3e/yjBt3p
r2IC75pMoqedV5f4
What is going on here? Why am I getting a different encryped string
than what they are sending me? Why can't I decrypt their encoding?
I see the following note in MSDN. Is this the cause of the problem?
Note: CAPICOM does not support the PKCS #7 EncryptedData content type
but uses a nonstandard ASN structure for EncryptedData. Therefore,
only CAPICOM can decrypt a CAPICOM EncryptedData object.
Is the correlary true? Can CAPICOM only decrypt a message that was
encrypted by CAPICOM?
Any help is greatly appreciated!
Regards,
Michael Levy
You need to find out exactly what format/app was used to encrypt
the data sent to you.
CAPICOM uses a derived symmetric encryption key, based on a combination
of a supplied password as UNICODE and an internal salt value (stored in the EncryptedData blob).
- Mitch Gallant
MVP Security
"Michael" <Mic...@MichaelLevy.net> wrote in message
news:4400d199.0402...@posting.google.com...
"The encryption was done using the Java sun.misc package
(Base64Encoder and Base64Decoder). The developers who did the work
extended these classes and wrote wrappers around new encrypt and
decrypt methods such that passing a key and value to be
encrypted/decrypted could be done more easily."
I know very little about Java. Based on the information they
provided, what do I need to do in order to decrypt the strings they
are sending to me?
Thanks,
Michael
Show them something like this:
Cipher c3des = Cipher.getInstance("DESede/CBC/PKCS5Padding");
SecretKeySpec myKey = new SecretKeySpec(tdesKeyData, "DESede");
IvParameterSpec ivspec = new IvParameterSpec(myIV);
and ask is that is their approach (standard symmetric encryption ... compatible with CryptoAPI and
.NET symmetric cipher).
- Mitch Gallant
"Michael" <Mic...@MichaelLevy.net> wrote in message
news:4400d199.04021...@posting.google.com...