Skip to content

Commit 42b366a

Browse files
committed
psa: Simplify DSA public key format
1 parent db35c62 commit 42b366a

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

include/psa/crypto.h

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,15 @@ psa_status_t psa_get_key_information(psa_key_handle_t handle,
372372
/**
373373
*
374374
* Format for the domain parameters varies by the key type.
375+
* - For DSA public keys (#PSA_KEY_TYPE_DSA_PUBLIC_KEY),
376+
* the `Dss-Parms` format as defined by RFC 3279 §2.3.2.
377+
* ```
378+
* Dss-Parms ::= SEQUENCE {
379+
* p INTEGER,
380+
* q INTEGER,
381+
* g INTEGER
382+
* }
383+
* ```
375384
* Must call before import key. If you want, you can call before generate key
376385
* or use extra to pass the domain parameters.
377386
*
@@ -424,19 +433,8 @@ psa_status_t psa_get_key_domain_parameters(uint8_t *data,
424433
* coefficient INTEGER, -- (inverse of q) mod p
425434
* }
426435
* ```
427-
* - For DSA private keys (#PSA_KEY_TYPE_DSA_KEYPAIR), the format
428-
* is the non-encrypted DER encoding of the representation used by
429-
* OpenSSL and OpenSSH, whose structure is described in ASN.1 as follows:
430-
* ```
431-
* DSAPrivateKey ::= SEQUENCE {
432-
* version INTEGER, -- must be 0
433-
* prime INTEGER, -- p
434-
* subprime INTEGER, -- q
435-
* generator INTEGER, -- g
436-
* public INTEGER, -- y
437-
* private INTEGER, -- x
438-
* }
439-
* ```
436+
* - For DSA private keys (#PSA_KEY_TYPE_DSA_KEYPAIR), the format is a
437+
* representation of the private key `x` as a big-endian byte string.
440438
* - For elliptic curve key pairs (key types for which
441439
* #PSA_KEY_TYPE_IS_ECC_KEYPAIR is true), the format is
442440
* a representation of the private value as a `ceiling(m/8)`-byte string
@@ -506,21 +504,8 @@ psa_status_t psa_export_key(psa_key_handle_t handle,
506504
* modulus INTEGER, -- n
507505
* publicExponent INTEGER } -- e
508506
* ```
509-
* - For DSA public keys (#PSA_KEY_TYPE_DSA_PUBLIC_KEY),
510-
* the `subjectPublicKey` format is defined by RFC 3279 §2.3.2 as
511-
* `DSAPublicKey`,
512-
* with the OID `id-dsa`,
513-
* and with the parameters `DSS-Parms`.
514-
* ```
515-
* id-dsa OBJECT IDENTIFIER ::= {
516-
* iso(1) member-body(2) us(840) x9-57(10040) x9cm(4) 1 }
517-
*
518-
* Dss-Parms ::= SEQUENCE {
519-
* p INTEGER,
520-
* q INTEGER,
521-
* g INTEGER }
522-
* DSAPublicKey ::= INTEGER -- public key, Y
523-
* ```
507+
* - For DSA public keys (#PSA_KEY_TYPE_DSA_PUBLIC_KEY), the format is a
508+
* representation of the public key `Y` as a big-endian byte string.
524509
* - For elliptic curve public keys (key types for which
525510
* #PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY is true),
526511
* the format is defined by RFC 3279 §2.3.5 as
@@ -2265,6 +2250,12 @@ typedef struct {
22652250
* specifying the public exponent. The
22662251
* default public exponent used when \p extra
22672252
* is \c NULL is 65537.
2253+
* - For an DSA key (\p type is
2254+
* #PSA_KEY_TYPE_DSA_KEYPAIR), \p extra is an
2255+
* optional structure specifying the key domain
2256+
* parameters. The key domain parameters can also be
2257+
* provided by psa_set_key_domain_parameters(),
2258+
* which documents the format of the structure.
22682259
* \param extra_size Size of the buffer that \p extra
22692260
* points to, in bytes. Note that if \p extra is
22702261
* \c NULL then \p extra_size must be zero.

0 commit comments

Comments
 (0)