Cryptographic Token Interface Standard |
PKCS#11 |
RSA public key objects (object class CKO_PUBLIC_KEY, key type CKK_RSA) hold RSA public keys. The following table defines the RSA public key object attributes, in addition to the common attributes listed in Table 15 , Table 19 , Table 25 , and Table 26 :
Table 28, RSA Public Key Object Attributes
Attribute | Data type | Meaning |
CKA_MODULUS1,4 | Big integer | Modulus n |
CKA_MODULUS_BITS2,3 | CK_ULONG | Length in bits of modulus n |
CKA_PUBLIC_EXPONENT1,3 | Big integer | Public exponent e |
Depending on the token, there may be limits on the length of key components. See PKCS #1 for more information on RSA keys.
The following is a sample template for creating an RSA public key object:
CK_OBJECT_CLASS class = CKO_PUBLIC_KEY; CK_KEY_TYPE keyType = CKK_RSA; CK_UTF8CHAR label[] = "An RSA public key object"; CK_BYTE modulus[] = {...}; CK_BYTE exponent[] = {...}; CK_BBOOL true = TRUE; CK_ATTRIBUTE template[] = { {CKA_CLASS, &class, sizeof(class)}, {CKA_KEY_TYPE, &keyType, sizeof(keyType)}, {CKA_TOKEN, &true, sizeof(true)}, {CKA_LABEL, label, sizeof(label)-1}, {CKA_WRAP, &true, sizeof(true)}, {CKA_ENCRYPT, &true, sizeof(true)}, {CKA_MODULUS, modulus, sizeof(modulus)}, {CKA_PUBLIC_EXPONENT, exponent, sizeof(exponent)} };