x509: implement RSA-PSS signature scheme
This patch enables RSA-PSS signature scheme in the X.509 functions and certtool.
When creating an RSA-PSS signature, there are 3 different scenarios:
- both a private key and a certificate are RSA-PSS
- the private key is RSA, while the certificate is RSA-PSS
- both the private key and the certificate are RSA
For (1) and (2), the RSA-PSS parameters are read from the certificate. Any conflicts in parameters between the private key and the certificate are reported as an error.
For (3), the sign functions, such as gnutls_x509_crt_privkey_sign()
or
gnutls_privkey_sign_data()
, shall be instructed to generate an RSA-PSS
signature. This can be done with the new flag GNUTLS_PRIVKEY_SIGN_FLAG_RSA_PSS
.
Verification is similar to signing, except for the case (3), use the
flag GNUTLS_VERIFY_USE_RSA_PSS
instead of GNUTLS_PRIVKEY_SIGN_FLAG_RSA_PSS
.
From the command line, certtool
has a couple of new options: --rsa-pss
and --rsa-pss-sign
. The --rsa-pss
option indicates that the generated
private key or certificate is restricted to RSA-PSS, while the
--rsa-pss-sign
option indicates that the generated certificate is signed
with RSA-PSS.
For simplicity, there is no means of choosing arbitrary salt length. When it is not given by a private key or a certificate, it is automatically calculated from the underlying hash algorithm and the RSA modulus bits.
Resolves #91 (closed)