This article link: http://www.cnblogs.com/Charltsing/p/TripleDES.html
As we all know, the tripledes algorithm that Java uses by default is the Ecb+pkcs#5 fill method. The VB6 algorithm that can be found online is incompatible with this.
Is there a simple way to achieve the common use between the two?
As you know, C # is capable of implementing the TripleDES algorithm, so you can invoke the static class of. NET in VBA, VBS, and vb6.0 to implement an encryption and decryption algorithm that is common to Java.
In VBA, call C # 's TripleDESCryptoServiceProvider, and set mode = CIPHERMODE.ECB.
If you have other questions, you can contact QQ564955427
***************************************************************************************************
It is important to note that C # supports the Pkcs#7 fill mode by default, and the pkcs#5 fill is generic by default, depending on the following text:
you can find the difference between the two definitions by reading the resources below:
[Def] PKCS #7: Cryptographic Message Syntax Standard,
An RSA laboratories Technical Note, Version 1.5. Revised November 1, 1993. HTTP://WWW.CNBLOGS.COM/MIDEA0978/ADMIN/FTP://FTP.RSA.COM/PUB/PKCS/ASCII/PKCS-7.ASC
[INF] PKCS #5: password-based Encryption Standard,
An RSA laboratories Technical Note, Version 1.5. Revised November 1, 1993. HTTP://WWW.CNBLOGS.COM/MIDEA0978/ADMIN/FTP://FTP.RSA.COM/PUB/PKCS/ASCII/PKCS-5.ASC
In pkcs5padding, it is clear that the size of the block is 8 bits, whereas in the pkcs7padding definition, the size of the block is indeterminate and can be between 1-255 (the length of the block is beyond 255), and the algorithm for populating the values is the same:
value=k-(l mod k), k= block size, l= data length, if l=8, you need to populate additional 8 byte 8
In . NET, for example, TripleDESCryptoServiceProvider, the default blocksize=64bits=8bytes, so in this case, in pkcs5padding=pkcs7padding.
If you define an encryption block size that is not 64bits in C # and use pkcs7padding at the same time, then the pkcs5padding that uses the JDK standard in Java cannot be decrypted.
How to make VBA and Java's tripledes algorithm common