Skip to content

Add RSA PKCS#1 1.5 signing #208

Closed
Closed

Description

@briansmith

There's a bunch of code to do the low-level RSA operation in GFp_rsa_private_transform in crypto/rsa/rsa_impl.c that should be used.

We need a new implementation of PKCS#1 1.5 padding (in Rust, unless there's a reason it can't be done in Rust for some reason).

We can (should, unless we're going to somehow implement blinding in Rust) use the blinding code in crypto/rsa/blinding.c. But, we need to write new Rust code that manages the pool of BN_BLINDINGs in some kind of thread-safe way. I guess this largely depends on the threading model chosen for the signing API.

NIST publishes test vectors for this, and testing using those test vectors are the minimum acceptable testing. Note that NIST's test vectors are in a format that's not really usable by ring's testing framework. The comments in src/rsa_pkcs1_verify_tests.txt explain what I did to reformat NIST's RSA PKCS#1 1.5 verification test vectors for ring; a similar thing needs to be done for the signing test vectors.

This is complicated by the fact that there's no code for deserializing RSA private keys or for serializing RSA private keys. Adding the deserialization/serialization is probably a big task on its own so it might be worth splitting into a separate bug.

See also #205 for any general requirements on signing APIs.

Activity

  1. briansmith commented on Jun 6, 2016

    @briansmith
    OwnerAuthor

    I am not going to have time to implement this, so I'm hoping somebody will volunteer to do it. It is not hard, but it isn't going to be as easy as #206 was. I recommend looking at #206 and the conversation in 211 to get a sense of how this would go down.

  2. briansmith commented on Jun 6, 2016

    @briansmith
    OwnerAuthor

    OK, I will break this down:

  3. briansmith commented on Jun 21, 2016

    @briansmith
    OwnerAuthor

    This all landed! Awesome work!

    In the last set of changes, I tweaked the example to match the ring style (qualifying Input as untrusted::Input, avoiding unwrap(), etc.). I also added some tests to complete(-ish) the test coverage.

    Thanks a ton for doing this!

  4. briansmith commented on Jun 21, 2016

    @briansmith
    OwnerAuthor

    I should add: #225 contains a laundry list of follow-up tasks for improving the RSA internals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions