Skip to content
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

oaep: support non-string labels #467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

baloo
Copy link
Member

@baloo baloo commented Jan 30, 2025

This rework oaep to support non-string labels.
One use-case is encryption of secrets in TPM.

https://trustedcomputinggroup.org/wp-content/uploads/TPM-2.0-1.83-Part-1-Architecture.pdf#page=297
Section B.4 RSAES_OAEP

For RSA keys protecting a secret value (such as, an encryption key or a session secret), the L parameter
is a byte stream, the last byte of which must be zero, indicating the intended use of the encrypted value. 

That would look like:

    let encrypted_seed = {
        let padding = Oaep::new_with_label::<EkHash, _>(b"IDENTITY\0".to_vec());
        let enc_data = ek_public
            .encrypt(&mut rng, padding, &random_seed[..])
            .expect("failed to encrypt");
        enc_data
    };

@baloo
Copy link
Member Author

baloo commented Jan 30, 2025

I'm pulling this PR in parallaxsecond/rust-tss-esapi#563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant