Questions tagged [pkcs11]

PKCS #11 (Public-Key Cryptography Standard 11) defines a platform-independent API to cryptographic tokens, such as hardware security modules (HSM) and smart cards called *Cryptoki*.

Filter by
Sorted by
Tagged with
0 votes
0 answers
113 views

PKCS#11 - Does a token need to be initialized in every client application to log in as the normal user with it?

I'm having some trouble understanding the idea behind C_InitToken. I can tell what it does from the standard, but not its purpose. One of the things it does is to provide authentication of the user as ...
chilliefiber's user avatar
1 vote
1 answer
202 views

In PKCS#11, can I set a custom base point for a secp256r1 ECDSA signature?

According to FIPS 186-4 § D.1.1.5 Choice of Base Points I should be able to create ECDSA signatures with custom base points on P-256 (secp256r1). Does standard PKCS#11 support this feature? This is ...
sander's user avatar
  • 63
0 votes
2 answers
509 views

Generation of RSA key pair and storage of only private key PKCS#11

I noticed that the PKCS#11 supports C_GenerateKey function for symmetric keys and for asymmetric there's only C_GenerateKeyPair ...
simonskof's user avatar
0 votes
2 answers
452 views

Wrong key length for EC public key

I have a problem with EC public key reading from smartcard using pkcs11 library. With the secp256r1 EC algorithm, I always get 65 or 67-byte length public key with different smartcards. But with the ...
Uzeyir's user avatar
  • 11
3 votes
3 answers
133 views

What is the purpose of implementing cryptographic algorithms in a token?

In particular, in PKCS #11. Not a lot of information on the web; I found this explanations. Ignoring the empty marketing talk like “heightened security” and “centralized and secure management”, I ...
beroal's user avatar
  • 291
2 votes
1 answer
4k views

Why is data signed with SHA256-RSA-PKCS and digest signed with RSA-PKCS different?

I need to sign some data using RSA. I have the digest that I can sign but the signature turns out different from the signing source data. There is data in data.bin and its sha256 digest in digest.bin <...
Margus Pala's user avatar
4 votes
1 answer
524 views

PKCS11: CKA_VALUE_LEN attribute and Unwrap key

In PKCS11 specification v2.40, we see some confusion with CKA_VALUE_LEN attribute and UnwrapKey behavior. From PKCS11 spec 2.40 ...
Brahmaji Kommanaboyina's user avatar
2 votes
1 answer
2k views

OID for Ed25519

I am working on a code generating Edwards curve (Ed25519) keys in a HSM using PKCS#11 API. In the public key template the CKA_EC_PARAMS uses an OID to specify the curve. The encoding for Ed25519 is ...
Peter's user avatar
  • 23
1 vote
1 answer
477 views

How is PKCS a syntax to digitally sign, digest, authenticate, or encrypt arbitrary message content

I am really confused over PKCS. I saw this question but I do not have enough reputation to leave a comment so I am asking a new question to clarify. I am trying to understand what exactly PKCS and in ...
Finlay Weber's user avatar
1 vote
1 answer
1k views

TDES (Triple DES) DUKPT decryption

We have a POS (Ingenico) that uses DES3-CBC encryption using a derived key. It sends encrypted data, and 10 bytes size Key Serial Number (KSN). I tried to use ...
onesick1's user avatar
2 votes
1 answer
173 views

Question on PKCS11 2.40 spec and AES_CBC wrap

PKCS11 cryptoki version 2.40 Current mechanism specification (section 2.8.5), says below statement for AES CBC wrap: For wrapping, the mechanism encrypts the value of the CKA_VALUE attribute of the ...
Brahmaji Kommanaboyina's user avatar
2 votes
1 answer
936 views

Inconsistency with PKCS#11 v2.40 CKM_AES_KEY_WRAP_PAD

There appears to be some inconsistencies between the PKCS#11 v2.40 Current Mechanism Specification and the specification for AES Key Wrap Pad as defined in SP800-38F. First, according to PKCS#11: ...
Mike's user avatar
  • 85
2 votes
1 answer
402 views

HMAC computation using AES key

I want to compute an HMAC value of a data set using CKM_SHA256_HMAC mechanism with AES key. I have the error code CKR_KEY_TYPE_INCONSISTENT because it seems that I need to use a key of key_type ...
Nitin V Kuttan's user avatar
2 votes
1 answer
1k views

Using PKCS #11 Certificate Objects for Verification

What is the proper way to use the public key contained in a X.509 certificate with PKCS #11? ...
rose's user avatar
  • 277
1 vote
0 answers
163 views

PKCS#11. Possibility of performing Ecryption/Decryption in hardware [closed]

Cheers. I'm dealing with HSM via PKCS#11 C/Python interface. I'm wondering is it possible to do some C_Encrypt/C_Decrypt in ...
Henadzi Matuts's user avatar
1 vote
0 answers
324 views

Unwrapping secrete key without exposing original key? [closed]

I am trying to unwrap a secret key (AES/DES) using Java APIs and SunPKCS11. Problem is that it reveals the value of an unwrapped key (out of HSM) in the key object. Here is the code: ...
snesh's user avatar
  • 11
3 votes
0 answers
153 views

What is the proper return code for C_Login when a CKU_SO attempts to log into a non-initialized token?

Looking at the PKCS#11 2.4 spec, C_Login returns CKR_USER_PIN_NOT_INITIALIZED when a "normal user's PIN has not yet been ...
Mike's user avatar
  • 85
2 votes
0 answers
345 views

What is a parallel session in PKCS#11

I have seen in the PKCS#11 spec that "parallel sessions" are not supported "in Cryptoki Version 2.01 and up, no token supports parallel sessions" but I can also ...
rose's user avatar
  • 277
1 vote
1 answer
99 views

How should short term keys (keys stored in RAM or volatile memory) be described by PKCS#11?

How are short term keys usually implemented by PKCS#11? Is the proper way to distinguish between keys that are more temporary/stored in volatile memory and those stored in non-volatile memory to ...
rose's user avatar
  • 277
3 votes
1 answer
587 views

RSA hybrid decryption via PKCS#11 - unwrap or decrypt?

I have an application that does RSA hybrid encryption/decryption – i.e., messages are encrypted with a fresh AES key, which is then itself encrypted with RSA-OAEP and sent with the message. Decryption ...
Neil Madden's user avatar
3 votes
1 answer
944 views

How can CKA_TRUSTED be set to true?

I'm confused by the wording of the PKCS#11 v2.40 specification in terms of when CKA_TRUSTED can be set to true on a public key certificate object: The ...
Mike's user avatar
  • 85
1 vote
1 answer
470 views

Basic question on interaction with HSM using PKCS11

I am a beginner on cryptography, I've been reading about PKCS11 and usage of PKCS11 on HSM's I understand the concept of HSM, I read about the HD wallets in bitcoin how keys are hashed and combined ...
f4r4's user avatar
  • 113
1 vote
1 answer
518 views

PKCS #11 – Deriving a Key where MSB perform encryption and LSB perform CMAC operation?

I am using Thales HSM, a PKCS #11 Compliant device. I have an 32 byte AES key and derivation input. I want to use AES-ECB encryption Mode to derive a 32 byte key where 16 MSB should be considered as ...
Karthick's user avatar
0 votes
2 answers
913 views

Is ssl_sign safe as it is using OPENSSL_PKCS1_PADDING

I've been hearing a lot of scare talk about PKCS1 padding attacks. Is PKCS1 v1.5 safe in signatures as it is practically transporting only message digest? I'm using it in one of my applications so i'...
Brlja's user avatar
  • 103
2 votes
1 answer
1k views

setting the MGF hash to a different value other than the regular hash with openssl for PSS signatures

In PKCS1's Probabilistic Signature Mode you have the Hash and the MGF Hash. Both appear to be, by default, sha1, with the OpenSSL CLI client, however, I can change it to sha256 with the following: <...
neubert's user avatar
  • 2,927
2 votes
1 answer
788 views

PKCS#11 Sessions [closed]

I am maintaining an application that uses PKCS#11 to talk to a smartcard. Somehow a session gets generated, but i cant figure out where in the code. I am using c# and the PKCS11Interop wrapper. The ...
randoms's user avatar
  • 131
3 votes
0 answers
582 views

Limit the number of private key uses for RSASSA-PKCS1-v1_5 with SHA-256 signature?

Assuming all messages and their signatures are available to the attacker, is it secure to use the same RSA private key to sign many messages (roughly $10^{6}$) via PKCS#11 ...
vlp's user avatar
  • 153
9 votes
5 answers
5k views

Source for PKCS#11 Header Files

Is there a known authoritative source for the ANSI C header files for PKCS#11 Cryptoki? Specifically, I am having trouble locating pkcs11.h, pkcs11t.h, and pkcs11f.h for v2.30 and v2.40. Are there ...
user25339's user avatar
4 votes
0 answers
382 views

Can CKM_RSA_PKCS signature be made secure by lowering its maximum input size?

The CKM_RSA_PKCS Mechanism in PKCS#11 is a signature scheme commonly used to implement RSASSA-PKCS1-v1_5 of PKCS#1 for data hashed externally to a PKCS#11 token (such as an HSM). Basically it is the (...
fgrieu's user avatar
  • 141k
3 votes
1 answer
2k views

How do SignRecover and VerifyRecover work?

In PKCS#11, there are the SignRecover and VerifyRecover methods, where the data can be recovered from the signature. How do these methods work? Can I implement signrecover and verifyrecover with ...
sfallahdoost's user avatar
3 votes
1 answer
628 views

Why is C_digest defined in PKCS#11?

Digesting doesn't require any key and can be performed on the client side. Why does the PKCS#11 token interface standard have a C_digest method? For example, why should I send my data to a PKCS11 HSM ...
sfallahdoost's user avatar
5 votes
2 answers
979 views

Smart Card - Entropy during on-board public key generation

I know that some (advanced) smart cards or tokens allow generating key pair directly on the device, but I wonder how the card can gather entropy during the process. Any idea ?
crypto-learner's user avatar
2 votes
0 answers
396 views

Does NSS fully implement PKCS 11?

I am looking towards using NSS in a Linux application that makes use of a TPM (HSM). So, I am checking the support of PKCS 11 in NSS, at least for the management of Elliptic Curve keys, signature with ...
lalebarde's user avatar
  • 207
1 vote
1 answer
2k views

Using C_Sign to create a PKCS7 signature

I am using the PKCS#11 function C_Sign to sign some data. The output I get is just a signature. How do I get it in PKCS#7 format - i.e. ASN1 with signature and certificate (for detached) or ASN1 with ...
user93353's user avatar
  • 2,213
5 votes
1 answer
6k views

What are options to compute DES retail MAC (aka ISO 9797-1 mode 3) under PKCS#11?

The DES retail MAC, also known as ISO 9797-1 mode 3 with DES, computes the MAC of a block of data using a 16-byte (112 bit) key. It can be seen as CBC-MAC using simple DES with the first half of the ...
fgrieu's user avatar
  • 141k
1 vote
1 answer
399 views

Does OpenTSA support PKCS11 to talk to HSMs?

We are planning to implement the time-stamping service (RFC 3161) using OpenTSA wanted to know: Does OpenTSA support PKCS-11 (Cryptoki) to talk to HSMs? BTW: I did not find documentation or much ...
java_enthu's user avatar
-1 votes
1 answer
6k views

Is the random data at the end of my decrypted message supposed to be there?

This is my PKCS#5 & AES/ECB Python 3.3 code: ...
Mr. Font's user avatar
2 votes
1 answer
675 views

PKCS#11: Can C_GetMechanismInfo() return CKR_OK on a disabled mechanism?

According to PKCS#11 v2.20, "C_GetMechanismInfo obtains information about a particular mechanism possibly supported by a token." Does that mean ...
N142857's user avatar
  • 125
11 votes
1 answer
6k views

CKM_RSA_PKCS vs CKM_RSA_X_509 mechanisms in PKCS#11

What is the exact difference between the CKM_RSA_PKCS and CKM_RSA_X_509 mechanisms in the PKCS#11 v2.20 specification (Please ...
Ehsan Khodarahmi's user avatar
0 votes
1 answer
287 views

PKCS#11: Which CKK_types are supported by CKM_PKCS5_PBKD2?

On Solaris there's a function pkcs11_PasswdToKey() which is a wrapper of C_GenerateKey(). I made a simple test and it turned out ...
N142857's user avatar
  • 125