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

javax.crypto.KeyGenerator.getInstance() does not work for codepage Cp037

XMLWordPrintable

    • jce1.2.2beta
    • sparc
    • solaris_2.6



        Name: asR10047 Date: 08/17/2001


        The method javax.crypto.KeyGenerator.getInstance() throws exception
        unexpected when work in Cp037 character encoding.

        Here is the example demonstrating the bug:
        ------------------ -----------------
        import java.security.NoSuchAlgorithmException
        import javax.crypto.KeyGenerator;

        public class CipherEBCDIC {

            public static void main(String[] argv) {
                String algorithm = "DES";
                try {
                    KeyGenerator kg = KeyGenerator.getInstance(algorithm);
                } catch(NoSuchAlgorithmException nsae) {
                }
                System.exit(0);
            }
        }
        -------------- Output from the test -----------------
        java -Dfile.encoding=Cp037 CipherEBCDIC
        Exception in thread "main" ÑKKʺúÐÐú¨Êú@ѺK¿úKÓ¿ÌúKúÐóúM¦ýóÚ`M-^EøKø`±±^T±^T^TK±±±^T±Ã^T^T±øM-^U^U©]ú@ÈÊÃÈýÐÈKMÈÊÃÈýÐÈKÑz·]Èñó@¿z@ÑKKM-^Bñú¿Êºúz@Èú@óú@ñ@úó@@úñóú@ÈÂóz@ѺK¿úKz@@±z@ºú@ú@óúúúú@ѺK¿úKKLúnM¦ýóÚ`M-^EøKø`±±^T±^T^TK±±±^T±Ã^T^T±øM-^U^U©]KKK@ø@

        That means (decoded into ASCII)
        java.lang.ExceptionInInitializerError
                at javax.crypto.KeyGenerator.getInstance([DashoPro-V2.2-110100.11101B001275])
                at CipherEBCDIC.main(CipherEBCDIC.java:9)
        Caused by: java.lang.SecurityException: Cannot set up certs for trusted CAs: javax.crypto.k: line 1: expected grant statement
                at javax.crypto.b.<clinit>([DashoPro-V2.2-110100.11101B001275])
                ... 2 more

        ------------------------------------------------------

        ======================================================================

              valeriep Valerie Peng
              anssunw Ans Ans (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: