Uploaded image for project: 'Commons Crypto'
  1. Commons Crypto
  2. CRYPTO-13

The API differences between apache.commons.crypto and JCE

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.0.0
    • Cipher
    • None

    Description

      Now, the API of CryptoInputStream & CryptoOutputStream are slightly different from JCE.
      In JCE, the cipher must be fully initialized before being used by a CipherInputStream

      // Jce API sample
      Cipher c= Cipher.getInstance("AES/GCM/NoPadding", "SunJCE");
      c.init(Cipher.DECRYPT_MODE, key, new GCMParameterSpec(128, iv));
      CipherInputStream cin = new CipherInputStream (InputStream is, Cipher c );
      

      Now, we do the initialization of cipher in the ctor of CryptoInputStream.

      //apache.commons.crypto API:
      CryptoInputStream(CipherTransformation transformation,  Properties props, InputStream in, byte[] key, byte[] iv)
      

      We should add an interface with two parameters like JCE. This interface would be convenient to support other mode in future such as GCM.
      And, Keeping the same API as JCE would more friendly to users.

      Attachments

        Activity

          People

            kexianda Xianda Ke
            kexianda Xianda Ke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: