Hi,
Is there a need to allow applications to only generate a private key object instead of generating the key pair.?? This is something we see often in our own infrastructure as well as customer deployments.
Steps Performed:
- generate key pair
- extract public key attribute(s)
- sometimes a certificate object is created on the token, or externally
- delete public key
- locally use private key for sign/decrypt/derive (depending on the specific use-case)
This use case, where you have the cert and key on the token, it's probably best *NOT* to delete the public key from the token (see publicly readable certs profile). That said, I think you are more interested the the ephemeral use case.
Most (but not all) private key types already contained the public key information.
Actually, This is really only true of RSA, however:
Now that we have the CKA_PUBLIC_KEY_INFO attribute, all private keys will have the corresponding public key information.??
I think this is the thing that makes the idea plausible.
So we could support a method for only generating the private key object to eliminate the extra overhead of creating and deleting the public key object; which significantly improve ephemeral/single-use key pair use-cases.
The ephemeral/single-use key pair use-cases. Aren't as outlined above, but may have a similar semantic.
- generate ephemeral key pair.
- extract the public key (via it's attributes)
- Send those attributes in a protocol
- delete public key....
- Receive ciphertext from protocol
- complete KEM/KEK/KEX operation.
- delete private key.
I could see this working in at least two ways:
- Support private key generation through the C_GenerateKey API, where only a single template is provided (the private key template plus the required attributes that were typically only provided in the public key template).
- Enhance C_GenerateKeyPair in a way that will instruct the token to only create the private key objects; potentially by only providing a single template (the private key template plus the required attributes that were typically only provided in the public key template).
To support this, we may want a token flag that would indicate if this type of functionality is supported or not.
yes, or we could have a C_GenerateSinglePrivateKey API. We are post PKCS #11 v3.0, so new functions for new operations is now considered the norm.
There may be other ways to support this.?? These are the only two solutions that we have considered so far.
Obviously this is a 3.3 or later enhancement:).
bob
Thanks
Darren
------------------------------
Darren Johnson
THALES
------------------------------
Original Message:
Sent: 9/12/2024 7:57:00 AM
From: Darren Johnson
Subject: Allowing the generation of private key objects only
Hi,
Is there a need to allow applications to only generate a private key object instead of generating the key pair. This is something we see often in our own infrastructure as well as customer deployments.
Steps Performed:
- generate key pair
- extract public key attribute(s)
- sometimes a certificate object is created on the token, or externally
- delete public key
- locally use private key for sign/decrypt/derive (depending on the specific use-case)
Most (but not all) private key types already contained the public key information. Now that we have the CKA_PUBLIC_KEY_INFO attribute, all private keys will have the corresponding public key information. So we could support a method for only generating the private key object to eliminate the extra overhead of creating and deleting the public key object; which significantly improve ephemeral/single-use key pair use-cases.
I could see this working in at least two ways:
- Support private key generation through the C_GenerateKey API, where only a single template is provided (the private key template plus the required attributes that were typically only provided in the public key template).
- Enhance C_GenerateKeyPair in a way that will instruct the token to only create the private key objects; potentially by only providing a single template (the private key template plus the required attributes that were typically only provided in the public key template).
To support this, we may want a token flag that would indicate if this type of functionality is supported or not.
There may be other ways to support this. These are the only two solutions that we have considered so far.
Thanks
Darren
------------------------------
Darren Johnson
THALES
------------------------------