proprietary RSA padding scheme in CryptoPP 5.x

17 views
Skip to first unread message

simon...@eftpos-engineering.ch

unread,
Jul 5, 2017, 9:08:12 AM7/5/17
to Crypto++ Users

Hi Everyone,

 

  • we are upgrading from CryptoPP 4.1 to CryptoPP 5.6.5 and face the problem that we have implemented our own RSA padding scheme via the template mechanism
  • unfortunately it seems that this templates do not exist anymore, is there another mechanism/templates/classes which can be used to implement a proprietary RSA padding?
  • basically the padding scheme just fills up the message with random data until the modulus length (unfortunately the overlying protocol does not uses a standardized padding scheme...)
  • any help is appreciated!
Best Regards,
Simon


example of typedef's used in CryptoPP 4.1
  

// RSA_MinPad_Decryptor and RSA_MinPad_Encryptor can be used with key sizes of

// up to 2056 bits. To support larger key sizes, the implementation of the

// MinimalPadding class would have to be modified.

 

typedef RSAPrivateKeyTemplate<DecryptorTemplate<MinimalPadding, InvertibleRSAFunction> > RSA_MinPad_Decryptor;

typedef RSAPublicKeyTemplate<EncryptorTemplate<MinimalPadding, RSAFunction>, RSA_MinPad_Decryptor> RSA_MinPad_Encryptor;

 

 

// RSA_MinPadNoLen_Decryptor and RSA_MinPadNoLen_Encryptor do not store the length

// of the encoded plaintext. Consequentially, when the ciphertext is decrypted, the

// recovered plaintext always has the maximum size allowed by the RSA keypair.

// The consumer application has to decide for itself where the end of the plaintext is.

 

typedef RSAPrivateKeyTemplate<DecryptorTemplate<MinimalPaddingNoLength, InvertibleRSAFunction> > RSA_MinPadNoLen_Decryptor;

typedef RSAPublicKeyTemplate<EncryptorTemplate<MinimalPaddingNoLength, RSAFunction>, RSA_MinPadNoLen_Decryptor> RSA_MinPadNoLen_Encryptor;

Jeffrey Walton

unread,
Jul 15, 2017, 11:22:23 AM7/15/17
to Crypto++ Users


On Wednesday, July 5, 2017 at 9:08:12 AM UTC-4, simon...@eftpos-engineering.ch wrote:

Hi Everyone,

 

  • we are upgrading from CryptoPP 4.1 to CryptoPP 5.6.5 and face the problem that we have implemented our own RSA padding scheme via the template mechanism
  • unfortunately it seems that this templates do not exist anymore, is there another mechanism/templates/classes which can be used to implement a proprietary RSA padding?
  • basically the padding scheme just fills up the message with random data until the modulus length (unfortunately the overlying protocol does not uses a standardized padding scheme...)
  • any help is appreciated!
Well, 4.1 predates my limited knowledge. I was still using proverbial training wheels back then.

It looks like the padding schemes were moved into their own class files. For example, OAEP is available in https://github.com/weidai11/cryptopp/blob/master/oaep.h. The base class, PK_EncryptionMessageEncodingMethod, is in https://github.com/weidai11/cryptopp/blob/master/pkcspad.h.

Sorry I cannot offer more.

Jeff
 
Reply all
Reply to author
Forward
0 new messages