cryptography icon indicating copy to clipboard operation
cryptography copied to clipboard

Support PSS X509 Signatures

Open reaperhulk opened this issue 8 years ago • 11 comments

This will require an API change to sign.

reaperhulk avatar Mar 22 '16 02:03 reaperhulk

Also need to know how to represent it on Certificate objects.

alex avatar Mar 22 '16 11:03 alex

First part of this is done, exposing the signature algorithm OID. Now we need to support this in sign.

alex avatar Sep 03 '16 01:09 alex

Just leaving a comment for motivation. Would love to see this implemented.

I work with code signing systems that includes messing around with certificates, and some platforms require PSS in the certificate chains.

xzr avatar Apr 03 '19 16:04 xzr

PSS end entity signatures or intermediates? (e.g. do you need signing or just parsing support?) Could you share the platform? It'd be useful to at least know where this is actually seen in the wild now. I was quietly hoping everything would just move to ECDSA (or EdDSA) signatures instead of RSA-PSS...

reaperhulk avatar Apr 05 '19 20:04 reaperhulk

GlobalSign supports the RSASSA-PSS signing algorithm for all S/MIME Certificates issued via Enterprise PKI (effective October 29, 2018). As of January 1, 2019, the German Energy Sector requires the RSASSA-PSS algorithm to be used for secure email communications with energy and water industry market participants. Please review the steps below to configure your Enterprise PKI Profile to use the RSASSA-PSS algorithm.

https://support.globalsign.com/customer/en/portal/articles/2958431-rsassa-pss-signing-algorithm-support

space88man avatar Apr 28 '19 00:04 space88man

Hi, I am also dropping a comment here as I would really like to use this feature. As a note, I would only need this for legacy reasons. An old implementation uses RSASSA-PSS signing algorithm and currently the certificates get signed with sha256WithRSAEncryption "1.2.840.113549.1.1.11".

bencedav avatar Sep 22 '20 14:09 bencedav

Hi, I'm also having issues to create X509 certificates with RSASSA-PSS. Is there any way to create a x509 certificate with Signature algorithm OID:<ObjectIdentifier(oid=1.2.840.113549.1.1.10, name=RSASSA-PSS)> except using OpenSSL command line under python ? The sha256WithRSAEncryption isn't supported anymore on the IoT hardware devices I'm working on.

bkerler avatar Jan 24 '22 19:01 bkerler

There is no mechanism in cryptography for generating PSS certs at this time. Implementing this is non-trivial so we continue to look for consistent use cases. Can you share what type of IoT devices require this?

reaperhulk avatar Jan 24 '22 19:01 reaperhulk

Sure, current devices from Qualcomm and Mediatek (required for firmware signing)

bkerler avatar Jan 25 '22 06:01 bkerler

See details for Qualcomm here: https://www.qualcomm.com/media/documents/files/secure-boot-and-image-authentication-technical-overview-v2-0.pdf. I can also provide real-world examples (certs) if needed.

bkerler avatar Jan 25 '22 06:01 bkerler

Thanks for the details. We've seen this as a request for firmware signing before as well. Hopefully someone will feel ambitious enough to tackle the work at some point!

reaperhulk avatar Jan 29 '22 20:01 reaperhulk

There is valid cert like https://www.d-trust.net/cgi-bin/D-TRUST_Root_CA_3_2021.crt use this signature hash algorithm. It would be great can support decode this kind of cert.

mingchen avatar Mar 25 '23 00:03 mingchen

The boot firmware for Armv7-A and Armv8-A processors (Cortex-A, including the ubiquitous A55) is called Trusted Firmware-A:

https://github.com/ARM-software/arm-trusted-firmware

TF-A loads a "firmware image package" (FIP) at bootup, containing device trees and secondary bootloaders. To enable the "trusted boot" mode, this FIP must also contain several signatures. TF-A provides a tool for generating these signatures.

TF-A uses mbedtls as the backend for both generating and loading certificates. TF-A appears to only support RSASSA-PSS certificates (although the generator also seems to support ECDSA, this doesn't appear to be supported by the loader yet).

We use python in our test suite to modify parts of the FIP before each test -- we hoped to be able to generate certificates for the modified data without needing to shell out to an external program.

Above, reaperhulk mentioned:

There is no mechanism in cryptography for generating PSS certs at this time.

As of now, it looks like support for various padding schemes has been added to the private key, e.g.:

https://github.com/pyca/cryptography/blob/main/src/cryptography/hazmat/backends/openssl/rsa.py#L505

However, the CertificateBuilder still doesn't support specifying a padding scheme.

Is this mostly a matter of API design at this point?

woodrowbarlow avatar Apr 13 '23 14:04 woodrowbarlow

Yes, if we can figure out the API design, actually supporting PSS in X.509 is very easy.

On Thu, Apr 13, 2023 at 10:51 AM Woodrow Barlow @.***> wrote:

The boot firmware for Armv7-A and Armv8-A processors (Cortex-A, including the ubiquitous A55) is called Trusted Firmware-A:

https://github.com/ARM-software/arm-trusted-firmware

TF-A loads a "firmware image package" (FIP) at bootup, containing device trees and secondary bootloaders. To enable the "trusted boot" mode, this FIP also must contain several signatures. TF-A provides a tool for generating these signatures.

TF-A uses mbedtls as the backend for both generating and loading certificates. TF-A appears to only support RSASSA-PSS certificates (although the generator also seems to support ECDSA, this doesn't appear to be supported by the loader yet).

We use python in our test suite to modify parts of the FIP before each test -- we hoped to be able to generate certificates for the modified data without needing to shell out to an external program.

Above, reaperhulk mentioned:

There is no mechanism in cryptography for generating PSS certs at this time.

As of now, it looks like support for various padding schemes has been added to the private key, e.g.:

https://github.com/pyca/cryptography/blob/main/src/cryptography/hazmat/backends/openssl/rsa.py#L505

However, the CertificateBuilder still doesn't support specifying a padding scheme.

Is this mostly a matter of API design at this point?

— Reply to this email directly, view it on GitHub https://github.com/pyca/cryptography/issues/2850#issuecomment-1507111679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGBALSD3LH35UFGONPLDXBAHG5ANCNFSM4B6W67VA . You are receiving this because you commented.Message ID: @.***>

-- All that is necessary for evil to succeed is for good people to do nothing.

alex avatar Apr 13 '23 14:04 alex

Actually it's nothing that really needs to be "designed". The API does already implement it, but it was hardcoded in this project to pkcsv15. I've already ported the changes, but it affects several other modules, tests etc. as well, as it would allow to use padding in general. I'm going to do some tests the next days and once finished, I'll push a PR. It should be fully downwards compatible and shouldn't break anything, if it turns out as expected.

bkerler avatar May 02 '23 16:05 bkerler

Thanks for working on this, we're looking forward to seeing the PR!

On Tue, May 2, 2023 at 12:32 PM Bjoern Kerler @.***> wrote:

Actually it's nothing that really needs to be "designed". The API does already implement it, but it was hardcoded in this project to pkcsv15. I've already ported the changes, but it affects several other modules, tests etc. as well, as it would allow to use padding in general. I'm going to do some tests the next days and once finished, I'll push a PR. It should be fully downwards compatible and shouldn't break anything, if it turns out as expected.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

-- All that is necessary for evil to succeed is for good people to do nothing.

alex avatar May 02 '23 16:05 alex

I've added the PR #8859 which should add support for padding of several different rsa certificate signing methods. pkcs7 might need further improvements, as padding support is prepared, but the documentation needs to show the possibility how to add padding different to pkcs1. Sorry if my rust stuff might be bad, but this is the first time I coded Rust at all :)

bkerler avatar May 02 '23 20:05 bkerler

With https://github.com/pyca/cryptography/commit/b436fafa7cf43c96f66d50162ac495c99ade1f39 landed, it's now possible to read a PSS certificate usefully.

alex avatar May 07 '23 20:05 alex

#8888 now adds support for signing with PSS.

alex avatar May 11 '23 01:05 alex

This is now complete.

alex avatar May 14 '23 12:05 alex