x509_sign_format.c
Go to the documentation of this file.
1 /**
2  * @file x509_signature_format.c
3  * @brief RSA/DSA/ECDSA/EdDSA signature formatting
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.6.6
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "pkix/x509_sign_format.h"
38 #include "encoding/asn1.h"
39 #include "encoding/oid.h"
40 #include "debug.h"
41 
42 //Check crypto library configuration
43 #if (X509_SUPPORT == ENABLED)
44 
45 
46 /**
47  * @brief Format SignatureAlgorithm structure
48  * @param[in] signatureAlgo Pointer to the SignatureAlgorithm structure
49  * @param[out] output Buffer where to format the ASN.1 structure
50  * @param[out] written Length of the resulting ASN.1 structure
51  * @return Error code
52  **/
53 
55  uint8_t *output, size_t *written)
56 {
57  error_t error;
58  size_t n;
59  size_t length;
60  uint8_t *p;
61  Asn1Tag tag;
62  X509SignatureAlgo signAlgo;
63  const HashAlgo *hashAlgo;
64 
65  //Point to the buffer where to write the ASN.1 structure
66  p = output;
67  //Length of the ASN.1 structure
68  length = 0;
69 
70  //Retrieve the signature algorithm that will be used to sign the certificate
71  error = x509GetSignHashAlgo(signatureAlgo, &signAlgo, &hashAlgo);
72  //Unsupported signature algorithm?
73  if(error)
74  return error;
75 
76  //The Algorithm field contains the OID for the algorithm used by the CA
77  //to sign the certificate
78  tag.constructed = FALSE;
81  tag.length = signatureAlgo->oid.length;
82  tag.value = signatureAlgo->oid.value;
83 
84  //Write the corresponding ASN.1 tag
85  error = asn1WriteTag(&tag, FALSE, p, &n);
86  //Any error to report?
87  if(error)
88  return error;
89 
90  //Advance data pointer
92  length += n;
93 
94 #if (X509_RSA_SUPPORT == ENABLED && RSA_SUPPORT == ENABLED)
95  //RSA signature algorithm?
96  if(signAlgo == X509_SIGN_ALGO_RSA)
97  {
98  //For RSA signature algorithm, the parameters component of that type
99  //shall be the ASN.1 type NULL (refer to RFC 3279, section 2.2.1)
100  tag.constructed = FALSE;
102  tag.objType = ASN1_TYPE_NULL;
103  tag.length = 0;
104  tag.value = NULL;
105 
106  //Write the corresponding ASN.1 tag
107  error = asn1WriteTag(&tag, FALSE, p, &n);
108  }
109  else
110 #endif
111 #if (X509_RSA_PSS_SUPPORT == ENABLED && RSA_SUPPORT == ENABLED)
112  //RSA-PSS signature algorithm?
113  if(signAlgo == X509_SIGN_ALGO_RSA_PSS)
114  {
115  size_t oidLen;
116  const uint8_t *oid;
117 
118  //Point to the object identifier
119  oid = signatureAlgo->oid.value;
120  oidLen = signatureAlgo->oid.length;
121 
122  //RSA-PSS with SHAKE signature algorithm?
125  {
126  //The encoding must omit the parameters field. Parameters are not used
127  //because the hash, mask generation algorithm, trailer, and salt are
128  //embedded in the OID definition (refer to RFC 8692, section 4.1.1)
129  n = 0;
130  }
131  else
132  {
133  //The parameters must be present when used in the algorithm identifier
134  //associated with a signature value (refer to RFC 4055, section 3.1)
135  error = x509FormatRsaPssParameters(&signatureAlgo->rsaPssParams, p,
136  &n);
137  }
138  }
139  else
140 #endif
141 #if (X509_DSA_SUPPORT == ENABLED && DSA_SUPPORT == ENABLED)
142  //DSA signature algorithm?
143  if(signAlgo == X509_SIGN_ALGO_DSA)
144  {
145  //For DSA signature algorithm, the encoding shall omit the parameters
146  //field (refer to RFC 3279, section 2.2.2)
147  n = 0;
148  }
149  else
150 #endif
151 #if (X509_ECDSA_SUPPORT == ENABLED && ECDSA_SUPPORT == ENABLED)
152  //ECDSA signature algorithm?
153  if(signAlgo == X509_SIGN_ALGO_ECDSA)
154  {
155  //For ECDSA signature algorithm, the encoding must omit the parameters
156  //field (refer to RFC 3279, section 2.2.3)
157  n = 0;
158  }
159  else
160 #endif
161 #if (X509_SM2_SUPPORT == ENABLED && SM2_SUPPORT == ENABLED)
162  //SM2 signature algorithm?
163  if(signAlgo == X509_SIGN_ALGO_SM2)
164  {
165  //If the signature algorithm is SM2, no parameters are involved
166  n = 0;
167  }
168  else
169 #endif
170 #if (X509_ED25519_SUPPORT == ENABLED && ED25519_SUPPORT == ENABLED)
171  //Ed25519 signature algorithm?
172  if(signAlgo == X509_SIGN_ALGO_ED25519)
173  {
174  //The parameters must be absent (refer to RFC 8410, section 6)
175  n = 0;
176  }
177  else
178 #endif
179 #if (X509_ED448_SUPPORT == ENABLED && ED448_SUPPORT == ENABLED)
180  //Ed448 signature algorithm?
181  if(signAlgo == X509_SIGN_ALGO_ED448)
182  {
183  //The parameters must be absent (refer to RFC 8410, section 6)
184  n = 0;
185  }
186  else
187 #endif
188 #if (X509_MLDSA44_SUPPORT == ENABLED && MLDSA44_SUPPORT == ENABLED)
189  //ML-DSA-44 signature algorithm?
190  if(signAlgo == X509_SIGN_ALGO_MLDSA44)
191  {
192  //The parameters must be absent (refer to RFC 9881, section 3)
193  n = 0;
194  }
195  else
196 #endif
197 #if (X509_MLDSA65_SUPPORT == ENABLED && MLDSA65_SUPPORT == ENABLED)
198  //ML-DSA-65 signature algorithm?
199  if(signAlgo == X509_SIGN_ALGO_MLDSA65)
200  {
201  //The parameters must be absent (refer to RFC 9881, section 3)
202  n = 0;
203  }
204  else
205 #endif
206 #if (X509_MLDSA87_SUPPORT == ENABLED && MLDSA87_SUPPORT == ENABLED)
207  //ML-DSA-87 signature algorithm?
208  if(signAlgo == X509_SIGN_ALGO_MLDSA87)
209  {
210  //The parameters must be absent (refer to RFC 9881, section 3)
211  n = 0;
212  }
213  else
214 #endif
215  //Invalid signature algorithm?
216  {
217  //Report an error
219  }
220 
221  //Check status code
222  if(error)
223  return error;
224 
225  //Advance data pointer
226  ASN1_INC_POINTER(p, n);
227  length += n;
228 
229  //The Algorithm and Parameters fields are encapsulated within a sequence
230  tag.constructed = TRUE;
233  tag.length = length;
234 
235  //Write the corresponding ASN.1 tag
236  error = asn1InsertHeader(&tag, output, &n);
237  //Any error to report?
238  if(error)
239  return error;
240 
241  //Total number of bytes that have been written
242  *written = length + n;
243 
244  //Successful processing
245  return NO_ERROR;
246 }
247 
248 
249 /**
250  * @brief Format SignatureValue field
251  * @param[in] prngAlgo PRNG algorithm
252  * @param[in] prngContext Pointer to the PRNG context
253  * @param[in] tbsCert Pointer to the TBSCertificate to be signed
254  * @param[in] signAlgoId Signature algorithm identifier
255  * @param[in] publicKeyInfo Signer's public key information
256  * @param[in] privateKey Signer's private key
257  * @param[out] output Buffer where to format the ASN.1 structure
258  * @param[out] written Length of the resulting ASN.1 structure
259  * @return Error code
260  **/
261 
262 error_t x509FormatSignatureValue(const PrngAlgo *prngAlgo, void *prngContext,
263  const X509OctetString *tbsCert, const X509SignAlgoId *signAlgoId,
264  const X509SubjectPublicKeyInfo *publicKeyInfo, const void *privateKey,
265  uint8_t *output, size_t *written)
266 {
267  error_t error;
268  size_t n;
269  uint8_t *p;
270  Asn1Tag tag;
271 
272  //Point to the buffer where to write the ASN.1 structure
273  p = output;
274 
275  //If the output parameter is NULL, then the function calculates the length
276  //of the ASN.1 structure without copying any data
277  if(p != NULL)
278  {
279  //The bit string shall contain an initial octet which encodes the number
280  //of unused bits in the final subsequent octet
281  p[0] = 0;
282 
283  //Advance data pointer
284  p++;
285  }
286 
287  //The ASN.1 DER-encoded tbsCertificate is used as the input to the signature
288  //function
289  error = x509GenerateSignature(prngAlgo, prngContext, tbsCert, signAlgoId,
290  privateKey, p, &n);
291  //Any error to report?
292  if(error)
293  return error;
294 
295  //The signature is encapsulated within a bit string
296  tag.constructed = FALSE;
299  tag.length = n + 1;
300 
301  //Write the corresponding ASN.1 tag
302  error = asn1InsertHeader(&tag, output, &n);
303  //Any error to report?
304  if(error)
305  return error;
306 
307  //Total number of bytes that have been written
308  *written = tag.totalLength;
309 
310  //Successful processing
311  return NO_ERROR;
312 }
313 
314 
315 /**
316  * @brief Format RSASSA-PSS parameters
317  * @param[in] rsaPssParams Pointer to the RSA-PSS parameters
318  * @param[out] output Buffer where to format the ASN.1 structure
319  * @param[out] written Length of the resulting ASN.1 structure
320  * @return Error code
321  **/
322 
324  uint8_t *output, size_t *written)
325 {
326  error_t error;
327  size_t n;
328  size_t length;
329  uint8_t *p;
330  Asn1Tag tag;
331 
332  //Point to the buffer where to write the ASN.1 structure
333  p = output;
334  //Length of the ASN.1 structure
335  length = 0;
336 
337  //Format hashAlgorithm parameter
338  error = x509FormatRsaPssHashAlgo(rsaPssParams, p, &n);
339  //Any error to report?
340  if(error)
341  return error;
342 
343  //Advance data pointer
344  ASN1_INC_POINTER(p, n);
345  length += n;
346 
347  //Format maskGenAlgorithm parameter
348  error = x509FormatRsaPssMaskGenAlgo(rsaPssParams, p, &n);
349  //Any error to report?
350  if(error)
351  return error;
352 
353  //Advance data pointer
354  ASN1_INC_POINTER(p, n);
355  length += n;
356 
357  //Format saltLength parameter
358  error = x509FormatRsaPssSaltLength(rsaPssParams, p, &n);
359  //Any error to report?
360  if(error)
361  return error;
362 
363  //Advance data pointer
364  ASN1_INC_POINTER(p, n);
365  length += n;
366 
367  //The RSASSA-PSS parameters are encapsulated within a sequence
368  tag.constructed = TRUE;
371  tag.length = length;
372 
373  //Write the corresponding ASN.1 tag
374  error = asn1InsertHeader(&tag, output, &n);
375  //Any error to report?
376  if(error)
377  return error;
378 
379  //Total number of bytes that have been written
380  *written = tag.totalLength;
381 
382  //Successful processing
383  return NO_ERROR;
384 }
385 
386 
387 /**
388  * @brief Format RSASSA-PSS hash algorithm
389  * @param[in] rsaPssParams Pointer to the RSA-PSS parameters
390  * @param[out] output Buffer where to format the ASN.1 structure
391  * @param[out] written Length of the resulting ASN.1 structure
392  * @return Error code
393  **/
394 
396  uint8_t *output, size_t *written)
397 {
398  error_t error;
399  size_t n;
400  Asn1Tag tag;
401 
402  //Length of the ASN.1 structure
403  n = 0;
404 
405  //The default hash algorithm is SHA-1
406  if(rsaPssParams->hashAlgo.value != NULL &&
407  rsaPssParams->hashAlgo.length > 0)
408  {
409  //Write the hash algorithm identifier
410  tag.constructed = FALSE;
413  tag.length = rsaPssParams->hashAlgo.length;
414  tag.value = rsaPssParams->hashAlgo.value;
415 
416  //Write the corresponding ASN.1 tag
417  error = asn1WriteTag(&tag, FALSE, output, &n);
418  //Any error to report?
419  if(error)
420  return error;
421 
422  //The hashAlgorithm parameter is encapsulated within a sequence
423  tag.constructed = TRUE;
426  tag.length = n;
427 
428  //Write the corresponding ASN.1 tag
429  error = asn1InsertHeader(&tag, output, &n);
430  //Any error to report?
431  if(error)
432  return error;
433 
434  //Get the length of the resulting sequence
435  n = tag.totalLength;
436 
437  //Explicit tagging shall be used to encode each parameter
438  tag.constructed = TRUE;
440  tag.objType = 0;
441  tag.length = n;
442 
443  //Write the corresponding ASN.1 tag
444  error = asn1InsertHeader(&tag, output, &n);
445  //Any error to report?
446  if(error)
447  return error;
448 
449  //Get the length of the resulting tag
450  n = tag.totalLength;
451  }
452 
453  //Total number of bytes that have been written
454  *written = n;
455 
456  //Successful processing
457  return NO_ERROR;
458 }
459 
460 
461 /**
462  * @brief Format RSASSA-PSS mask generation algorithm
463  * @param[in] rsaPssParams Pointer to the RSA-PSS parameters
464  * @param[out] output Buffer where to format the ASN.1 structure
465  * @param[out] written Length of the resulting ASN.1 structure
466  * @return Error code
467  **/
468 
470  uint8_t *output, size_t *written)
471 {
472  error_t error;
473  size_t n;
474  size_t length;
475  uint8_t *p;
476  Asn1Tag tag;
477 
478  //Point to the buffer where to write the ASN.1 structure
479  p = output;
480  //Length of the ASN.1 structure
481  length = 0;
482 
483  //The default mask generation function is MGF1
484  if(rsaPssParams->maskGenAlgo.value != NULL &&
485  rsaPssParams->maskGenAlgo.length > 0)
486  {
487  //Write the mask generation algorithm identifier
488  tag.constructed = FALSE;
491  tag.length = rsaPssParams->maskGenAlgo.length;
492  tag.value = rsaPssParams->maskGenAlgo.value;
493 
494  //Write the corresponding ASN.1 tag
495  error = asn1WriteTag(&tag, FALSE, p, &n);
496  //Any error to report?
497  if(error)
498  return error;
499 
500  //Advance data pointer
501  ASN1_INC_POINTER(p, n);
502  length += n;
503 
504  //Write the algorithm identifier of the one-way hash function employed
505  //with the mask generation function
506  error = x509FormatRsaPssMaskGenHashAlgo(rsaPssParams, p, &n);
507  //Any error to report?
508  if(error)
509  return error;
510 
511  //Advance data pointer
512  ASN1_INC_POINTER(p, n);
513  length += n;
514 
515  //The maskGenAlgorithm parameter is encapsulated within a sequence
516  tag.constructed = TRUE;
519  tag.length = length;
520 
521  //Write the corresponding ASN.1 tag
522  error = asn1InsertHeader(&tag, output, &n);
523  //Any error to report?
524  if(error)
525  return error;
526 
527  //Get the length of the resulting sequence
528  n = tag.totalLength;
529 
530  //Explicit tagging shall be used to encode each parameter
531  tag.constructed = TRUE;
533  tag.objType = 1;
534  tag.length = n;
535 
536  //Write the corresponding ASN.1 tag
537  error = asn1InsertHeader(&tag, output, &n);
538  //Any error to report?
539  if(error)
540  return error;
541 
542  //Get the length of the resulting tag
543  length = tag.totalLength;
544  }
545 
546  //Total number of bytes that have been written
547  *written = length;
548 
549  //Successful processing
550  return NO_ERROR;
551 }
552 
553 
554 /**
555  * @brief Format RSASSA-PSS mask generation hash algorithm
556  * @param[in] rsaPssParams Pointer to the RSA-PSS parameters
557  * @param[out] output Buffer where to format the ASN.1 structure
558  * @param[out] written Length of the resulting ASN.1 structure
559  * @return Error code
560  **/
561 
563  uint8_t *output, size_t *written)
564 {
565  error_t error;
566  size_t n;
567  Asn1Tag tag;
568 
569  //Length of the ASN.1 structure
570  n = 0;
571 
572  //The default hash algorithm is SHA-1
573  if(rsaPssParams->maskGenHashAlgo.value != NULL &&
574  rsaPssParams->maskGenHashAlgo.length > 0)
575  {
576  //Write the algorithm identifier of the one-way hash function employed
577  //with the mask generation function
578  tag.constructed = FALSE;
581  tag.length = rsaPssParams->maskGenHashAlgo.length;
582  tag.value = rsaPssParams->maskGenHashAlgo.value;
583 
584  //Write the corresponding ASN.1 tag
585  error = asn1WriteTag(&tag, FALSE, output, &n);
586  //Any error to report?
587  if(error)
588  return error;
589 
590  //The hash algorithm identifier is encapsulated within a sequence
591  tag.constructed = TRUE;
594  tag.length = n;
595 
596  //Write the corresponding ASN.1 tag
597  error = asn1InsertHeader(&tag, output, &n);
598  //Any error to report?
599  if(error)
600  return error;
601 
602  //Get the length of the resulting sequence
603  n = tag.totalLength;
604  }
605 
606  //Total number of bytes that have been written
607  *written = n;
608 
609  //Successful processing
610  return NO_ERROR;
611 }
612 
613 
614 /**
615  * @brief Format RSASSA-PSS salt length
616  * @param[in] rsaPssParams Pointer to the RSA-PSS parameters
617  * @param[out] output Buffer where to format the ASN.1 structure
618  * @param[out] written Length of the resulting ASN.1 structure
619  * @return Error code
620  **/
621 
623  uint8_t *output, size_t *written)
624 {
625  error_t error;
626  size_t n;
627  Asn1Tag tag;
628 
629  //Length of the ASN.1 structure
630  n = 0;
631 
632  //The default length of the salt is 20
633  if(rsaPssParams->saltLen != 20)
634  {
635  //Write the length of the salt
636  error = asn1WriteInt32((int32_t) rsaPssParams->saltLen, FALSE, output, &n);
637  //Any error to report?
638  if(error)
639  return error;
640 
641  //Explicit tagging shall be used to encode the saltLength parameter
642  tag.constructed = TRUE;
644  tag.objType = 2;
645  tag.length = n;
646 
647  //Write the corresponding ASN.1 tag
648  error = asn1InsertHeader(&tag, output, &n);
649  //Any error to report?
650  if(error)
651  return error;
652 
653  //Get the length of the resulting tag
654  n = tag.totalLength;
655  }
656 
657  //Total number of bytes that have been written
658  *written = n;
659 
660  //Successful processing
661  return NO_ERROR;
662 }
663 
664 #endif
@ X509_SIGN_ALGO_MLDSA65
Definition: x509_common.h:717
const uint8_t RSASSA_PSS_SHAKE256_OID[8]
Definition: rsa.c:89
#define PrngAlgo
Definition: crypto.h:1140
X509OctetString hashAlgo
Definition: x509_common.h:1151
OID (Object Identifier)
uint8_t p
Definition: ndp.h:300
#define TRUE
Definition: os_port.h:50
error_t asn1InsertHeader(Asn1Tag *tag, uint8_t *data, size_t *written)
Insert an ASN.1 tag header.
Definition: asn1.c:643
error_t x509FormatRsaPssSaltLength(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS salt length.
X509OctetString maskGenHashAlgo
Definition: x509_common.h:1153
error_t x509GenerateSignature(const PrngAlgo *prngAlgo, void *prngContext, const X509OctetString *tbsData, const X509SignAlgoId *signAlgoId, const void *privateKey, uint8_t *output, size_t *written)
Signature generation.
uint8_t oid[]
Definition: lldp_tlv.h:300
@ X509_SIGN_ALGO_MLDSA44
Definition: x509_common.h:716
size_t totalLength
Definition: asn1.h:111
size_t length
Definition: asn1.h:109
#define FALSE
Definition: os_port.h:46
X509SignatureAlgo
Signature algorithms.
Definition: x509_common.h:707
error_t
Error codes.
Definition: error.h:43
#define ASN1_CLASS_UNIVERSAL
Definition: asn1.h:52
error_t x509FormatRsaPssHashAlgo(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS hash algorithm.
ASN.1 tag.
Definition: asn1.h:105
#define ASN1_INC_POINTER(p, n)
Definition: asn1.h:58
@ X509_SIGN_ALGO_ECDSA
Definition: x509_common.h:712
error_t x509FormatSignatureValue(const PrngAlgo *prngAlgo, void *prngContext, const X509OctetString *tbsCert, const X509SignAlgoId *signAlgoId, const X509SubjectPublicKeyInfo *publicKeyInfo, const void *privateKey, uint8_t *output, size_t *written)
Format SignatureValue field.
error_t x509FormatRsaPssMaskGenAlgo(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS mask generation algorithm.
General definitions for cryptographic algorithms.
error_t x509GetSignHashAlgo(const X509SignAlgoId *signAlgoId, X509SignatureAlgo *signAlgo, const HashAlgo **hashAlgo)
Get the signature and hash algorithms that match the specified identifier.
Definition: x509_common.c:447
error_t x509FormatRsaPssMaskGenHashAlgo(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS mask generation hash algorithm.
error_t asn1WriteTag(Asn1Tag *tag, bool_t reverse, uint8_t *data, size_t *written)
Write an ASN.1 tag.
Definition: asn1.c:334
error_t x509FormatSignatureAlgo(const X509SignAlgoId *signatureAlgo, uint8_t *output, size_t *written)
Format SignatureAlgorithm structure.
uint_t objClass
Definition: asn1.h:107
@ X509_SIGN_ALGO_MLDSA87
Definition: x509_common.h:718
uint8_t length
Definition: tcp.h:375
X509OctetString oid
Definition: x509_common.h:1164
X509OctetString maskGenAlgo
Definition: x509_common.h:1152
@ X509_SIGN_ALGO_RSA
Definition: x509_common.h:709
RSA/DSA/ECDSA/EdDSA signature generation.
@ X509_SIGN_ALGO_RSA_PSS
Definition: x509_common.h:710
#define OID_COMP(oid1, oidLen1, oid2)
Definition: oid.h:42
uint8_t n
Subject Public Key Information extension.
Definition: x509_common.h:908
#define ASN1_CLASS_CONTEXT_SPECIFIC
Definition: asn1.h:54
uint8_t oidLen
Definition: lldp_tlv.h:299
bool_t constructed
Definition: asn1.h:106
RSASSA-PSS parameters.
Definition: x509_common.h:1150
@ ASN1_TYPE_OBJECT_IDENTIFIER
Definition: asn1.h:77
@ ASN1_TYPE_SEQUENCE
Definition: asn1.h:83
const uint8_t * value
Definition: x509_common.h:762
Common interface for hash algorithms.
Definition: crypto.h:1243
@ ASN1_TYPE_BIT_STRING
Definition: asn1.h:74
@ ERROR_UNSUPPORTED_SIGNATURE_ALGO
Definition: error.h:132
@ X509_SIGN_ALGO_SM2
Definition: x509_common.h:713
Octet string.
Definition: x509_common.h:761
@ X509_SIGN_ALGO_ED25519
Definition: x509_common.h:714
const uint8_t RSASSA_PSS_SHAKE128_OID[8]
Definition: rsa.c:87
error_t asn1WriteInt32(int32_t value, bool_t reverse, uint8_t *data, size_t *written)
Write a 32-bit integer to the output stream.
Definition: asn1.c:781
X509RsaPssParameters rsaPssParams
Definition: x509_common.h:1166
const uint8_t * value
Definition: asn1.h:110
Signature algorithm identifier.
Definition: x509_common.h:1163
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
uint_t objType
Definition: asn1.h:108
error_t x509FormatRsaPssParameters(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS parameters.
ASN.1 (Abstract Syntax Notation One)
@ X509_SIGN_ALGO_DSA
Definition: x509_common.h:711
@ X509_SIGN_ALGO_ED448
Definition: x509_common.h:715
@ ASN1_TYPE_NULL
Definition: asn1.h:76