Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7050158

Cipher in plain RSA signing treats private keys as public

XMLWordPrintable

        Consider the following code snippet

        Cipher rsa = Cipher.getInstance("RSA","SunMSCAPI");
        rsa.init(Cipher.ENCRYPT_MODE, privateKey);

        The resulting Cipher is the same as if a corresponding publicKey was provided.

        At CU's opinion using Cipher API for encryption with private key is not a common case but it is not a misuse of the API. SunJCE provider supports such scenario.
        PKCS #7 signed data specification describes encryption with the private key
        see http://www.ietf.org/rfc/rfc2315.txt

        The request is to initialize Ciphers with the private key if a private key is provided in case of SunMSCAPI - encryption.

              vinnie Vincent Ryan
              ikrylov Ivan Krylov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: