Link to home
Start Free TrialLog in
Avatar of kkhan7
kkhan7

asked on

CryptoAPI in VBA 7

I am trying to use CryptoAPI using VBA 7 in a Windows 7,  64 bit environment.  Will this ever work?  I am trying to use Cryptography for Visual Basics by Richard Bondi but this is not working.  I getting type mismatch on CryptImportKey function for the Pointer to the CSP handler.

What would be the best way to implement Encryption/Decryption in this environment?
Avatar of Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Flag of United States of America image

Her is what i use:  Encryption
ASKER CERTIFIED SOLUTION
Avatar of danishani
danishani
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kkhan7
kkhan7

ASKER

Daniel,  

Thanks for your reply.  However, I had tried the code from the jdk site and I am using the correct PtrSafe datatypes and I am still receiving errors.  The VB code will work in using VBA in a Windows 7, 64-bit environment?
Are you using he Access 2010 64-bit?  

I run Access 2003/2007/2010 32-bit versions on 64-bit windows OS's without having to use PtrSafe datatypes. AFAIK, you only need to use PtrSafe datatypes in VBA with Office 2010 64-bit apps.

The link I provided work fine on XP 64-bit/Vista 64-bit/Win 7 64-bit with Access 2003/2007/2010 32-bit.
Avatar of kkhan7

ASKER

Daniel,

Yes, I am using MS Access 64-bit, VBA 7 on Windows 7, 64-bit environment.  I get errors on CreateImportKey function when trying to import a private key.

Signed,
KKhan7
Avatar of kkhan7

ASKER

Daniel,

Thanks for your help.  I have switched to using Visual Studio 2010 to create a .NET class that I can call from VBA.

http://support.microsoft.com/kb/317535

Article ID: 317535 - Last Review: March 29, 2007 - Revision: 8.5

HOW TO: Call a Visual Basic .NET Class Library from Visual Basic for Applications in Microsoft Office


Signed,
KKhan7
Avatar of kkhan7

ASKER

This solution had lots of information it just didn't work for my situation.