-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMS EnvelopedData
#1115
CMS EnvelopedData
#1115
Conversation
…ms/enveloped-content
@bkstein being able to pass in an RNG is nice for One option would be to add a |
@tarcieri An |
@tarcireri As for the failing test: I use |
I can cut a release, then you can bump the minor version requirement |
This looks like a good start. Two thoughts as it moves forward. As with my suggestion (earlier today) re: signer identifiers, it may be nice to interrogate the key encryption info for the recipient identifier. Similarly, it may be good to define a few traits so algorithm and padding details don't live in the builder object. This will likely matter more as key agreement and KEM support is added but at present OAEP would require a new builder implementation. |
@tarcieri I'm not sure, if you saw my 👍? A new release were nice. However, I'm working on the rng feature and I hope, I can push it by the end of this week. |
@carl-wallace you address a point, that I would like to improve, too. I also don't like my hardcoded implementation of the encryption. I searched for a way how we could leave the choice for encryption algorithms to the user of this crate. My first idea was to pass an encryptor, but there is no common trait for that. What, if the builder accepted a pub trait Encryptor {
fn encrypt(data: &[u8]) -> Result<Vec<u8>>;
} which must be implemented by the user? This would keep all encryption details outside the builder. |
That could work. I wonder if a companion to the signature crate is really what's needed though (maybe as a longer term goal). |
@bkstein |
I made rng an input parameter for key and content encryption. This will probably become obsolete anyway, when and if encryption details are moved out of the builders. |
@bkstein if you think the PR is ready for review, can you remove draft? |
@tarcieri I'd like to test the implementation in our project. Just to make sure, I didn't miss something. This shouldn't take too long. I'll remove the draft then. |
FWIW, I should be able to give the EnvelopedData some exercise on a project over the next week or two (as part of SCEP execution). @bkstein I am curious if you have tried SignedData with a SignerInfo that used SKID for identifying the signer (the openssl test cases look to use issuer/serial). In some interop work today I ran into an issue and it looks like
should have been
|
@carl-wallace I'm also integrating the PR in our SCEP application to see, if it really works. But I think, you found an error: according to the ASN.1 specification in RFC 5652 § 12.1 all
|
Re: SCEP, I had success this morning but had to make one change relative to the test code. The message type attribute should be a PrintableString (see table 1 in section 3.2.1 in RFC8894). The code that worked for me was:
This change was in addition to the change noted earlier relative to key identifier variant of SignerIdentifier. Oddly, RecipientIdentifier was fine. This was part of an implementation of a client for Apple's Over-the-Air profile delivery and configuration protocol to provision a yubikey (with a custom attribute included in the SCEP request to convey an attestation to the CA). I exercised both the SignedData and EnvelopedData builders (as well as some of the untested code in the yubikey crate along with one or two additions there). Those worked well. I have some cleanup to do before contemplating PRs. |
Just a heads up, I might want to publish a release of CMS by the end of this week (to pull the I guess you'd need a |
Re: CMS release, please make sure to include the tagging change for SignerIdentifier that's in this PR. |
Re: CMS, we probably should remove setting the signing time attribute first. Or move creation of this attribute into an own method for convenience, if someone should need it. I'm still busy with replacing our rust-openssl implementation with RustCrypto cms. Thus not sure, if I will be able to do it until Friday. But I can try it. |
@baloo Correct. I currently have to use my own defnitions, until the |
Curious, which RFC defines that as u32? all I could find was RFC5280:
Is there someone with more than 255 certificates in a chain?!? @bkstein did you remove the comment? Or am I crazy? |
@baloo I'm sorry for the confusion. Yes, I deleted the comment. I think, you are right. I read about the meaning of |
Empty |
@bkstein needs rustfmt |
This PR brings a builder for CMS
EnvelopedData
and aRecipientInfo
trait. OnlyKeyTransRecipientInfo
with RSA was implemented for key encryption, but the code is prepared for beeing extended to all otherRecipientInfo
s and arbitrary encryption algorithms. Volunteers are welcome 🙂.Open issues:
encrypt()
function.