EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Import certificate into a PKCS11 store

Posted: 05/16/2014 04:11:58
by Ludo De Clercq (Premium support level)
Joined: 04/14/2014
Posts: 2

I am trying to add a certificate to a PKCS11 store.
My code:

String paramSlotToOpen = cboSlots.Text;
TElPKCS11SessionInfo Session = null;
TElPKCS11CertStorage Storage = null;

Storage = new TElPKCS11CertStorage();
Storage.DLLName = paramPkcs11Dll;

// Find the slot
int slotIndex = -1;
for (int i = 0; i < Storage.Module.SlotCount; i++)
if (Storage.Module.get_Slot(i).TokenLabel == paramSlotToOpen)

slotIndex = i;

if (slotIndex != -1)
Session = Storage.OpenSession(slotIndex, false);

Session.Login((int)SBPKCS11Base.Unit.utSecurityOfficer, "");

if (Session != null)
int keyCount = Storage.KeyCount;
TElKeyMaterial key = Storage.get_Keys(0);

TElMemoryCertStorage m = loadCertificateStore(txtCertificateFile.Text);

TElX509Certificate certificate = GetCertificate(m, 0);

Storage.Add(certificate, false);


The error occured in 'Storage.Add' with the following message:
'PKCS#11 error CKR_ATTRIBUTE_VALUE_INVALID in function C_CreateObject'

In the documentation of the HSM :
Posted: 05/16/2014 04:15:22
by Eugene Mayevski (Team)

And what your question is?

On a side note please use CODE button to mark the beginning and the end of the code block in your messages.

Sincerely yours
Eugene Mayevski
Posted: 05/16/2014 04:18:53
by Ludo De Clercq (Premium support level)
Joined: 04/14/2014
Posts: 2

I can not insert the certificate into PKCS11 store.
It's generate the following error:
'PKCS#11 error CKR_ATTRIBUTE_VALUE_INVALID in function C_CreateObject'

I don't know how resolve this ?
Can please help my?
Posted: 05/16/2014 04:30:50
by Ken Ivanov (Team)

Hi Ludo,

I've moved your question to the Helpdesk (ticket #25344), let's continue the discussion there.




Topic viewed 1015 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!