|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Using RSAES OAEP with a custom padding parameterI'm attempting to write a wrapper aroung the API defined for the
trusted platform module. The Design Principles specification from the trusted computing group (http://www.trustedcomputinggroup.org/ resources/tpm_main_specification) states that when using the TPM_ES_RSAESOAEP_SHA1_MGF1 encryption type, that " The OAEP encoding P parameter MUST be the 4 character string “TCPA” ". I use the following code when performing RSAES_OAEP encryption. How can I modify it to set the padding parameter to "TCPA"? std::vector<BYTE> EncryptDataUsingRSAES_OAEP_SHA( std::vector<BYTE> vDataToEncrypt, std::vector<BYTE> vTpmRsaPubKeyModulus) { std::vector<BYTE> cipher; CryptoPP::AutoSeededRandomPool rng; CryptoPP::Integer modulus(&vTpmRsaPubKeyModulus[0], vTpmRsaPubKeyModulus.size()); CryptoPP::RSA::PublicKey publicKey; publicKey.SetPublicExponent(65537); // TPM uses 65537 as public exponent publicKey.SetModulus(modulus); CryptoPP::RSAES_OAEP_SHA_Encryptor e(publicKey); CryptoPP::SecByteBlock sbbCipherText(e.CiphertextLength(vDataToEncrypt.size())); e.Encrypt( rng, &vDataToEncrypt[0], vDataToEncrypt.size(), sbbCipherText.begin() ); cipher.assign(sbbCipherText.BytePtr(), sbbCipherText.BytePtr() + sbbCipherText.size()); return cipher; } -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. |
|
|
Re: Using RSAES OAEP with a custom padding parameterOn Oct 22, 6:37 am, Charles T <charles...@...> wrote: > I'm attempting to write a wrapper aroung the API defined for the > trusted platform module. The Design Principles specification from the > trusted computing group (http://www.trustedcomputinggroup.org/ > resources/tpm_main_specification) states that when using the > TPM_ES_RSAESOAEP_SHA1_MGF1 encryption type, that " The OAEP encoding P > parameter MUST be the 4 character string “TCPA” ". > > I use the following code when performing RSAES_OAEP encryption. How > can I modify it to set the padding parameter to "TCPA"? I don't believe modifying the padding after the fact will work well (if at all). For this, I believe the best course of action is to provide a TPM_ES_RSAESOAEP_SHA1_MGF1 class. Then ne TPM padding class probably should probably look a lot like PK_EncryptionMessageEncodingMethod or OAEP < H, M >, See http://www.cryptopp.com/docs/ref/annotated.html, http://www.cryptopp.com/docs/ref/class_p_k___encryption_message_encoding_method.html and http://www.cryptopp.com/docs/ref/class_o_a_e_p.html. jeff Jeff -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. |
|
|
Re: Using RSAES OAEP with a custom padding parameterHi Charles,
My solution was: CryptoPP::ConstByteArrayParameter p("TCPA"); CryptoPP::AlgorithmParameters algParams = CryptoPP::MakeParameters(CryptoPP::Name::EncodingParameters(), p, true); CryptoPP::RSAES_OAEP_SHA_Encryptor encryptor(publicKey); encryptor.Encrypt(rng, plain, plainSize, enc, algParams); So far, it is working. Regards, Jan On Sat, Oct 22, 2011 at 12:37, Charles T <charleshlt@...> wrote: I'm attempting to write a wrapper aroung the API defined for the -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. |
|
|
Re: Using RSAES OAEP with a custom padding parameterH Jan
That's exactly what I was looking for, and it works for me too. Thank you. -Charles On Oct 24, 9:55 am, Honza Smrček <honza.smr...@...> wrote: > Hi Charles, > > My solution was: > > CryptoPP::ConstByteArrayParameter p("TCPA"); > CryptoPP::AlgorithmParameters algParams = > CryptoPP::MakeParameters(CryptoPP::Name::EncodingParameters(), p, true); > > CryptoPP::RSAES_OAEP_SHA_Encryptor encryptor(publicKey); > encryptor.Encrypt(rng, plain, plainSize, enc, algParams); > > So far, it is working. > > Regards, > Jan > > > > On Sat, Oct 22, 2011 at 12:37, Charles T <charles...@...> wrote: > > I'm attempting to write a wrapper aroung the API defined for the > > trusted platform module. The Design Principles specification from the > > trusted computing group (http://www.trustedcomputinggroup.org/ > > resources/tpm_main_specification) states that when using the > > TPM_ES_RSAESOAEP_SHA1_MGF1 encryption type, that " The OAEP encoding P > > parameter MUST be the 4 character string “TCPA” ". > > > I use the following code when performing RSAES_OAEP encryption. How > > can I modify it to set the padding parameter to "TCPA"? > > > std::vector<BYTE> EncryptDataUsingRSAES_OAEP_SHA( std::vector<BYTE> > > vDataToEncrypt, > > std::vector<BYTE> > > vTpmRsaPubKeyModulus) > > { > > > std::vector<BYTE> cipher; > > > CryptoPP::AutoSeededRandomPool rng; > > CryptoPP::Integer modulus(&vTpmRsaPubKeyModulus[0], > > vTpmRsaPubKeyModulus.size()); > > CryptoPP::RSA::PublicKey publicKey; > > > publicKey.SetPublicExponent(65537); // TPM uses 65537 as public > > exponent > > publicKey.SetModulus(modulus); > > > CryptoPP::RSAES_OAEP_SHA_Encryptor e(publicKey); > > > CryptoPP::SecByteBlock > > sbbCipherText(e.CiphertextLength(vDataToEncrypt.size())); > > > e.Encrypt( rng, &vDataToEncrypt[0], vDataToEncrypt.size(), > > sbbCipherText.begin() ); > > > cipher.assign(sbbCipherText.BytePtr(), sbbCipherText.BytePtr() + > > sbbCipherText.size()); > > > return cipher; > > > } > > > -- > > You received this message because you are subscribed to the "Crypto++ > > Users" Google Group. > > To unsubscribe, send an email to > > cryptopp-users-unsubscribe@.... > > More information about Crypto++ and this group is available at > >http://www.cryptopp.com.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. |
| Free embeddable forum powered by Nabble | Forum Help |