X64 references

210 views
Skip to first unread message

El1Bx

unread,
May 10, 2012, 3:53:22 AM5/10/12
to eID Middleware Dev
Hi,

I want to use beidpkcs11.dll in a x64 program. I have to do so because
I also need a Exchange 2010 reference in the same program that's only
available in x64.

Is there a x64 version available?
Eli

Frederik Vernelen

unread,
May 10, 2012, 4:13:32 AM5/10/12
to El1Bx, eID Middleware Dev
Hello Eli,

The x64 version of the beidpkcs11.dll is installed (during eIDMW install) on 64bit windows in the windows/system32 folder. (the x86 version of beidpkcs11.dll is installed on 64bit windows in the windows/sysWOW64 folder).

On 32 bit windows, the x64 version of beidpkcs11.dll is not installed during eIDMW installation.

Wkr,
 Frederik

Frederik Vernelen

unread,
May 10, 2012, 6:14:27 AM5/10/12
to Eli Backs, eID Middleware Dev
Hello,

Did you also build the net.pkcs11.dll in 64 bit?

Wkr,
 Frederik

On Thu, May 10, 2012 at 11:47 AM, Eli Backs <e...@backs.be> wrote:

Hi,

 

I copied the beidpkcs.dll from the sys32 folder.

Put my code in x64 mode.

Now I get this error : Could not load file or assembly 'Net.Pkcs11, Version=1.1.4512.24369,

 

Eli

Frederik Vernelen

unread,
May 10, 2012, 6:44:50 AM5/10/12
to Eli Backs, eID Middleware Dev
You can find the source code under svn at https://pkcs11net.svn.sourceforge.net/svnroot/pkcs11net/trunk/pkcs11Wrapper



On Thu, May 10, 2012 at 12:36 PM, Eli Backs <e...@backs.be> wrote:

I didn’t build it.

Where can I find the source code to build it?

I just took the dll from svn76

Frederik Vernelen

unread,
May 10, 2012, 8:20:59 AM5/10/12
to Eli Backs, eID Middleware Dev
Nice,

Did you change the allignement of the CK_ATTRIBUTE struct in the pkcs11.net project?

8.1 Structure packing
Cryptoki structures are packed to occupy as little space as is possible. In
particular, on
the Win32 and Win16 platforms, Cryptoki structures should be packed with
1-byte
alignment. In a UNIX environment, it may or may not be necessary (or even
possible) to
alter the byte-alignment of structures.


We (beidpkcs11.dll) package the pkcs11 structs always with 1-byte
alignment, but the pkcs11net wrapper uses the default (which happens to be
8-byte on my latest setup here)

How to change the alignment of the pkcs11net wrapper structs:
e.g. for the CK_ATTRIBUTE struct:
in CK_ATTRIBUTE.cs change
[StructLayout(LayoutKind.Sequential,Charset.Unicode)] to
[StructLayout(LayoutKind.Sequential,Charset.Unicode,Pack=1)]


Wkr,
 Frederik

On Thu, May 10, 2012 at 2:08 PM, Eli Backs <e...@backs.be> wrote:

Ok thanks,

I build all the DLL’s in x64 without error now.

 

My code runs without error, but my token session gives me no results in x64.

In x86 it works fine.

 

                    ByteArrayAttribute classAttribute = new ByteArrayAttribute(CKA.CLASS);

                    classAttribute.Value = BitConverter.GetBytes((uint)Net.Sf.Pkcs11.Wrapper.CKO.DATA);

                    session.FindObjectsInit(new P11Attribute[] { classAttribute });

                    P11Object[] foundObjects = session.FindObjects(50);

 

 

foundObjects in x64 is 0, in x86 its 43.

Reply all
Reply to author
Forward
0 new messages