• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OAEP cannot be used to sign or verify signatures

 
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We've been using RSA BSafe as a JCE provider in our product. I've been investigating whether it's possible to remove BSafe and just use the standard JCE implementation included in the JRE. It all works fine apart from one place. I am trying to decrypt an encrypted key. This is the code.



keydata is a byte[] containing random bytes and encodedPublicKey is the encrypted key.

This works fine if we use the BSafe library (or even BouncyCastle) as the JCE provider but if I try using the standard JCE the call to Cipher.init throws up an error
OAEP cannot be used to sign or verify signatures

I googled that message and found the openjdk source code where the init method at line 243 throws this error if the mode is DECRYPT_MODE, the key is an RSAPublicKey and the padding type is not PAD_NONE or PAD_PKCS1.

I'm afraid I'm not an expert on encryption (and the people who wrote the code are not with the company anymore), but I was wondering if there is any way I can change this code but still maintain backwards compatibility i.e. be able to decrypt keys that have been encrypted using the RSA/ECB/OAEPWithSHA1AndMGF1Padding algorithm.

Any thoughts or suggestions are welcome.

Stuart
 
The only cure for that is hours of television radiation. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic