Skip to content

Commit

Permalink
export-object: Recover public key from algorithm specific attributes
Browse files Browse the repository at this point in the history
Some tokens such as SoftHSMv2 omits CKA_PUBLIC_KEY_INFO when it can be
derived from algorithm specific attributes, such as CKA_MODULUS and
CKA_PUBLIC_EXPONENT for RSA.  This adds support for it if libtasn1 is
available at compile time.

Signed-off-by: Daiki Ueno <[email protected]>
  • Loading branch information
ueno committed Sep 21, 2023
1 parent 65f0fcd commit 746ee29
Show file tree
Hide file tree
Showing 4 changed files with 329 additions and 55 deletions.
3 changes: 3 additions & 0 deletions common/oid.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,7 @@ static const unsigned char P11_OID_RESERVED_PURPOSE[] =
{ 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x99, 0x77, 0x06, 0x0a, 0x10 };
static const char P11_OID_RESERVED_PURPOSE_STR[] = "1.3.6.1.4.1.3319.6.10.16";

static const char P11_OID_PKIX1_RSA_STR[] = "1.2.840.113549.1.1.1";
static const char P11_OID_PKIX1_EC_STR[] = "1.2.840.10045.2.1";

#endif
7 changes: 7 additions & 0 deletions common/pkix.asn
Original file line number Diff line number Diff line change
Expand Up @@ -537,4 +537,11 @@ ProxyPolicy ::= SEQUENCE {
policyLanguage OBJECT IDENTIFIER,
policy OCTET STRING OPTIONAL }

RSAPublicKey ::= SEQUENCE {
modulus INTEGER,
publicExponent INTEGER }

ECParameters ::= CHOICE {
namedCurve OBJECT IDENTIFIER }

END
Loading

0 comments on commit 746ee29

Please sign in to comment.