96. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 9/25/2018 2:13:02 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

96.1 Files compared

# Location File Last Modified
1 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\crypto\provider PBEKeyFactory.java Mon Jan 22 14:46:50 2018 UTC
2 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\crypto\provider PBEKeyFactory.java Wed Sep 12 16:22:36 2018 UTC

96.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 608
Changed 2 4
Inserted 0 0
Removed 0 0

96.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

96.4 Active regular expressions

No regular expressions were active.

96.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 199 7, 2014, O racle and/ or its aff iliates. A ll rights  reserved.
  3    * DO NOT  ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER.
  4    *
  5    * This co de is free  software;  you can r edistribut e it and/o r modify i t
  6    * under t he terms o f the GNU  General Pu blic Licen se version  2 only, a s
  7    * publish ed by the  Free Softw are Founda tion.  Ora cle design ates this
  8    * particu lar file a s subject  to the "Cl asspath" e xception a s provided
  9    * by Orac le in the  LICENSE fi le that ac companied  this code.
  10    *
  11    * This co de is dist ributed in  the hope  that it wi ll be usef ul, but WI THOUT
  12    * ANY WAR RANTY; wit hout even  the implie d warranty  of MERCHA NTABILITY  or
  13    * FITNESS  FOR A PAR TICULAR PU RPOSE.  Se e the GNU  General Pu blic Licen se
  14    * version  2 for mor e details  (a copy is  included  in the LIC ENSE file  that
  15    * accompa nied this  code).
  16    *
  17    * You sho uld have r eceived a  copy of th e GNU Gene ral Public  License v ersion
  18    * 2 along  with this  work; if  not, write  to the Fr ee Softwar e Foundati on,
  19    * Inc., 5 1 Franklin  St, Fifth  Floor, Bo ston, MA 0 2110-1301  USA.
  20    *
  21    * Please  contact Or acle, 500  Oracle Par kway, Redw ood Shores , CA 94065  USA
  22    * or visi t www.orac le.com if  you need a dditional  informatio n or have  any
  23    * questio ns.
  24    */
  25  
  26   package co m.sun.cryp to.provide r;
  27  
  28   import jav a.security .InvalidKe yException ;
  29   import jav a.security .spec.KeyS pec;
  30   import jav a.security .spec.Inva lidKeySpec Exception;
  31   import jav ax.crypto. SecretKey;
  32   import jav ax.crypto. SecretKeyF actorySpi;
  33   import jav ax.crypto. spec.PBEKe ySpec;
  34   import jav a.util.Has hSet;
  35   import jav a.util.Loc ale;
  36  
  37   /**
  38    * This cl ass implem ents a key  factory f or PBE key s accordin g to PKCS# 5,
  39    * meaning  that the  password m ust consis t of print able ASCII  character s
  40    * (values  32 to 126  decimal i nclusive)  and only t he low ord er 8 bits
  41    * of each  password  character  are used.
  42    *
  43    * @author  Jan Luehe
  44    *
  45    */
  46   abstract c lass PBEKe yFactory e xtends Sec retKeyFact orySpi {
  47  
  48       privat e String t ype;
  49       privat e static H ashSet<Str ing> valid Types;
  50  
  51       /**
  52        * Sim ple constr uctor
  53        */
  54       privat e PBEKeyFa ctory(Stri ng keytype ) {
  55           ty pe = keyty pe;
  56       }
  57  
  58       static  {
  59           va lidTypes =  new HashS et<String> (17);
  60           va lidTypes.a dd("PBEWit hMD5AndDES ".toUpperC ase(Locale .ENGLISH)) ;
  61           va lidTypes.a dd("PBEWit hSHA1AndDE Sede".toUp perCase(Lo cale.ENGLI SH));
  62           va lidTypes.a dd("PBEWit hSHA1AndRC 2_40".toUp perCase(Lo cale.ENGLI SH));
  63           va lidTypes.a dd("PBEWit hSHA1AndRC 2_128".toU pperCase(L ocale.ENGL ISH));
  64           va lidTypes.a dd("PBEWit hSHA1AndRC 4_40".toUp perCase(Lo cale.ENGLI SH));
  65           va lidTypes.a dd("PBEWit hSHA1AndRC 4_128".toU pperCase(L ocale.ENGL ISH));
  66           //  Proprieta ry algorit hm.
  67           va lidTypes.a dd("PBEWit hMD5AndTri pleDES".to UpperCase( Locale.ENG LISH));
  68           va lidTypes.a dd("PBEWit hHmacSHA1A ndAES_128" .toUpperCa se(Locale. ENGLISH));
  69           va lidTypes.a dd("PBEWit hHmacSHA22 4AndAES_12 8".toUpper Case(Local e.ENGLISH) );
  70           va lidTypes.a dd("PBEWit hHmacSHA25 6AndAES_12 8".toUpper Case(Local e.ENGLISH) );
  71           va lidTypes.a dd("PBEWit hHmacSHA38 4AndAES_12 8".toUpper Case(Local e.ENGLISH) );
  72           va lidTypes.a dd("PBEWit hHmacSHA51 2AndAES_12 8".toUpper Case(Local e.ENGLISH) );
  73           va lidTypes.a dd("PBEWit hHmacSHA1A ndAES_256" .toUpperCa se(Locale. ENGLISH));
  74           va lidTypes.a dd("PBEWit hHmacSHA22 4AndAES_25 6".toUpper Case(Local e.ENGLISH) );
  75           va lidTypes.a dd("PBEWit hHmacSHA25 6AndAES_25 6".toUpper Case(Local e.ENGLISH) );
  76           va lidTypes.a dd("PBEWit hHmacSHA38 4AndAES_25 6".toUpper Case(Local e.ENGLISH) );
  77           va lidTypes.a dd("PBEWit hHmacSHA51 2AndAES_25 6".toUpper Case(Local e.ENGLISH) );
  78       }
  79  
  80       public  static fi nal class  PBEWithMD5 AndDES
  81                extends  PBEKeyFact ory {
  82           pu blic PBEWi thMD5AndDE S()  {
  83                super("P BEWithMD5A ndDES");
  84           }
  85       }
  86  
  87       public  static fi nal class  PBEWithSHA 1AndDESede
  88                extends  PBEKeyFact ory {
  89           pu blic PBEWi thSHA1AndD ESede()  {
  90                super("P BEWithSHA1 AndDESede" );
  91           }
  92       }
  93  
  94       public  static fi nal class  PBEWithSHA 1AndRC2_40
  95                extends  PBEKeyFact ory {
  96           pu blic PBEWi thSHA1AndR C2_40()  {
  97                super("P BEWithSHA1 AndRC2_40" );
  98           }
  99       }
  100  
  101       public  static fi nal class  PBEWithSHA 1AndRC2_12 8
  102                extends  PBEKeyFact ory {
  103           pu blic PBEWi thSHA1AndR C2_128()   {
  104                super("P BEWithSHA1 AndRC2_128 ");
  105           }
  106       }
  107  
  108       public  static fi nal class  PBEWithSHA 1AndRC4_40
  109                extends  PBEKeyFact ory {
  110           pu blic PBEWi thSHA1AndR C4_40()  {
  111                super("P BEWithSHA1 AndRC4_40" );
  112           }
  113       }
  114  
  115       public  static fi nal class  PBEWithSHA 1AndRC4_12 8
  116                extends  PBEKeyFact ory {
  117           pu blic PBEWi thSHA1AndR C4_128()   {
  118                super("P BEWithSHA1 AndRC4_128 ");
  119           }
  120       }
  121  
  122       /*
  123        * Pri vate propr ietary alg orithm for  supportin g JCEKS.
  124        */
  125       public  static fi nal class  PBEWithMD5 AndTripleD ES
  126                extends  PBEKeyFact ory {
  127           pu blic PBEWi thMD5AndTr ipleDES()   {
  128                super("P BEWithMD5A ndTripleDE S");
  129           }
  130       }
  131  
  132       public  static fi nal class  PBEWithHma cSHA1AndAE S_128
  133                extends  PBEKeyFact ory {
  134           pu blic PBEWi thHmacSHA1 AndAES_128 ()  {
  135                super("P BEWithHmac SHA1AndAES _128");
  136           }
  137       }
  138  
  139       public  static fi nal class  PBEWithHma cSHA224And AES_128
  140                extends  PBEKeyFact ory {
  141           pu blic PBEWi thHmacSHA2 24AndAES_1 28()  {
  142                super("P BEWithHmac SHA224AndA ES_128");
  143           }
  144       }
  145  
  146       public  static fi nal class  PBEWithHma cSHA256And AES_128
  147                extends  PBEKeyFact ory {
  148           pu blic PBEWi thHmacSHA2 56AndAES_1 28()  {
  149                super("P BEWithHmac SHA256AndA ES_128");
  150           }
  151       }
  152  
  153       public  static fi nal class  PBEWithHma cSHA384And AES_128
  154                extends  PBEKeyFact ory {
  155           pu blic PBEWi thHmacSHA3 84AndAES_1 28()  {
  156                super("P BEWithHmac SHA384AndA ES_128");
  157           }
  158       }
  159  
  160       public  static fi nal class  PBEWithHma cSHA512And AES_128
  161                extends  PBEKeyFact ory {
  162           pu blic PBEWi thHmacSHA5 12AndAES_1 28()  {
  163                super("P BEWithHmac SHA512AndA ES_128");
  164           }
  165       }
  166  
  167       public  static fi nal class  PBEWithHma cSHA1AndAE S_256
  168                extends  PBEKeyFact ory {
  169           pu blic PBEWi thHmacSHA1 AndAES_256 ()  {
  170                super("P BEWithHmac SHA1AndAES _256");
  171           }
  172       }
  173  
  174       public  static fi nal class  PBEWithHma cSHA224And AES_256
  175                extends  PBEKeyFact ory {
  176           pu blic PBEWi thHmacSHA2 24AndAES_2 56()  {
  177                super("P BEWithHmac SHA224AndA ES_256");
  178           }
  179       }
  180  
  181       public  static fi nal class  PBEWithHma cSHA256And AES_256
  182                extends  PBEKeyFact ory {
  183           pu blic PBEWi thHmacSHA2 56AndAES_2 56()  {
  184                super("P BEWithHmac SHA256AndA ES_256");
  185           }
  186       }
  187  
  188       public  static fi nal class  PBEWithHma cSHA384And AES_256
  189                extends  PBEKeyFact ory {
  190           pu blic PBEWi thHmacSHA3 84AndAES_2 56()  {
  191                super("P BEWithHmac SHA384AndA ES_256");
  192           }
  193       }
  194  
  195       public  static fi nal class  PBEWithHma cSHA512And AES_256
  196                extends  PBEKeyFact ory {
  197           pu blic PBEWi thHmacSHA5 12AndAES_2 56()  {
  198                super("P BEWithHmac SHA512AndA ES_256");
  199           }
  200       }
  201  
  202       /**
  203        * Gen erates a < code>Secre tKey</code > object f rom the pr ovided key
  204        * spe cification  (key mate rial).
  205        *
  206          * @param k eySpec the  specifica tion (key  material)  of the  PW        key
  207        *
  208          * @return  the  PW        key
  209        *
  210        * @ex ception In validKeySp ecExceptio n if the g iven key s pecificati on
  211        * is  inappropri ate for th is key fac tory to pr oduce a pu blic key.
  212        */
  213       protec ted Secret Key engine GenerateSe cret(KeySp ec keySpec )
  214           th rows Inval idKeySpecE xception
  215       {
  216           if  (!(keySpe c instance of PBEKeyS pec)) {
  217                throw ne w InvalidK eySpecExce ption("Inv alid key s pec");
  218           }
  219           re turn new P BEKey((PBE KeySpec)ke ySpec, typ e);
  220       }
  221  
  222       /**
  223        * Ret urns a spe cification  (key mate rial) of t he given k ey
  224        * in  the reques ted format .
  225        *
  226        * @pa ram key th e key
  227        *
  228        * @pa ram keySpe c the requ ested form at in whic h the key  material s hall be
  229        * ret urned
  230        *
  231        * @re turn the u nderlying  key specif ication (k ey materia l) in the
  232        * req uested for mat
  233        *
  234        * @ex ception In validKeySp ecExceptio n if the r equested k ey specifi cation is
  235        * ina ppropriate  for the g iven key,  or the giv en key can not be pro cessed
  236        * (e. g., the gi ven key ha s an unrec ognized al gorithm or  format).
  237        */
  238       protec ted KeySpe c engineGe tKeySpec(S ecretKey k ey, Class< ?> keySpec Cl)
  239           th rows Inval idKeySpecE xception {
  240           if  ((key ins tanceof Se cretKey)
  241                && (vali dTypes.con tains(key. getAlgorit hm().toUpp erCase(Loc ale.ENGLIS H)))
  242                && (key. getFormat( ).equalsIg noreCase(" RAW"))) {
  243  
  244                // Check  if reques ted key sp ec is amon gst the va lid ones
  245                if ((key SpecCl !=  null)
  246                    && P BEKeySpec. class.isAs signableFr om(keySpec Cl)) {
  247                    byte [] passwdB ytes = key .getEncode d();
  248                    char [] passwdC hars = new  char[pass wdBytes.le ngth];
  249                    for  (int i=0;  i<passwdCh ars.length ; i++)
  250                         passwdChar s[i] = (ch ar) (passw dBytes[i]  & 0x7f);
  251                    PBEK eySpec ret  = new PBE KeySpec(pa sswdChars) ;
  252                    // p assword ch ar[] was c loned in P BEKeySpec  constructo r,
  253                    // s o we can z ero it out  here
  254                    java .util.Arra ys.fill(pa sswdChars,  ' ');
  255                    java .util.Arra ys.fill(pa sswdBytes,  (byte)0x0 0);
  256                    retu rn ret;
  257                } else {
  258                    thro w new Inva lidKeySpec Exception( "Invalid k ey spec");
  259                }
  260           }  else {
  261                throw ne w InvalidK eySpecExce ption("Inv alid key "
  262                                                     + "f ormat/algo rithm");
  263           }
  264       }
  265  
  266       /**
  267        * Tra nslates a  <code>Secr etKey</cod e> object,  whose pro vider may  be
  268        * unk nown or po tentially  untrusted,  into a co rrespondin g
  269        * <co de>SecretK ey</code>  object of  this key f actory.
  270        *
  271        * @pa ram key th e key whos e provider  is unknow n or untru sted
  272        *
  273        * @re turn the t ranslated  key
  274        *
  275        * @ex ception In validKeyEx ception if  the given  key canno t be proce ssed by
  276        * thi s key fact ory.
  277        */
  278       protec ted Secret Key engine TranslateK ey(SecretK ey key)
  279           th rows Inval idKeyExcep tion
  280       {
  281           tr y {
  282                if ((key  != null)  &&
  283                    (val idTypes.co ntains(key .getAlgori thm().toUp perCase(Lo cale.ENGLI SH))) &&
  284                    (key .getFormat ().equalsI gnoreCase( "RAW"))) {
  285  
  286                    // C heck if ke y originat es from th is factory
  287                    if ( key instan ceof com.s un.crypto. provider.P BEKey) {
  288                         return key ;
  289                    }
  290  
  291                    // C onvert key  to spec
  292                    PBEK eySpec pbe KeySpec =  (PBEKeySpe c)engineGe tKeySpec
  293                         (key, PBEK eySpec.cla ss);
  294  
  295                    // C reate key  from spec,  and retur n it
  296                    retu rn engineG enerateSec ret(pbeKey Spec);
  297                } else {
  298                    thro w new Inva lidKeyExce ption("Inv alid key f ormat/algo rithm");
  299                }
  300  
  301           }  catch (Inv alidKeySpe cException  ikse) {
  302                throw ne w InvalidK eyExceptio n("Cannot  translate  key: "
  303                                                 + ikse.g etMessage( ));
  304           }
  305       }
  306   }