98. 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.

98.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 PBKDF2HmacSHA1Factory.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 PBKDF2HmacSHA1Factory.java Wed Sep 12 16:22:39 2018 UTC

98.2 Comparison summary

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

98.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

98.4 Active regular expressions

No regular expressions were active.

98.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 200 5, 2011, 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  
  35   /**
  36    * This cl ass implem ents a key  factory f or PBE key s derived  using
  37    * PBKDF2  with HmacS HA1 psuedo  random fu nction(PRF ) as defin ed in
  38    * PKCS#5  v2.0.
  39    *
  40    * @author  Valerie P eng
  41    *
  42    */
  43   public fin al class P BKDF2HmacS HA1Factory  extends S ecretKeyFa ctorySpi {
  44  
  45       /**
  46        * Emp ty constru ctor
  47        */
  48       public  PBKDF2Hma cSHA1Facto ry() {
  49       }
  50  
  51       /**
  52        * Gen erates a < code>Secre tKey</code > object f rom the pr ovided key
  53        * spe cification  (key mate rial).
  54        *
  55          * @param k eySpec the  specifica tion (key  material)  of the  PW        key
  56        *
  57          * @return  the  PW        key
  58        *
  59        * @ex ception In validKeySp ecExceptio n if the g iven key s pecificati on
  60        * is  inappropri ate for th is key fac tory to pr oduce a pu blic key.
  61        */
  62       protec ted Secret Key engine GenerateSe cret(KeySp ec keySpec )
  63           th rows Inval idKeySpecE xception
  64       {
  65           if  (!(keySpe c instance of PBEKeyS pec)) {
  66                throw ne w InvalidK eySpecExce ption("Inv alid key s pec");
  67           }
  68           PB EKeySpec k s = (PBEKe ySpec) key Spec;
  69           re turn new P BKDF2KeyIm pl(ks, "Hm acSHA1");
  70       }
  71  
  72       /**
  73        * Ret urns a spe cification  (key mate rial) of t he given k ey
  74        * in  the reques ted format .
  75        *
  76        * @pa ram key th e key
  77        *
  78        * @pa ram keySpe c the requ ested form at in whic h the key  material s hall be
  79        * ret urned
  80        *
  81        * @re turn the u nderlying  key specif ication (k ey materia l) in the
  82        * req uested for mat
  83        *
  84        * @ex ception In validKeySp ecExceptio n if the r equested k ey
  85        * spe cification  is inappr opriate fo r the give n key, or  the
  86        * giv en key can not be pro cessed (e. g., the gi ven key ha s an
  87        * unr ecognized  algorithm  or format) .
  88        */
  89       protec ted KeySpe c engineGe tKeySpec(S ecretKey k ey, Class< ?> keySpec Cl)
  90           th rows Inval idKeySpecE xception {
  91           if  (key inst anceof jav ax.crypto. interfaces .PBEKey) {
  92                // Check  if reques ted key sp ec is amon gst the va lid ones
  93                if ((key SpecCl !=  null)
  94                    && P BEKeySpec. class.isAs signableFr om(keySpec Cl)) {
  95                    java x.crypto.i nterfaces. PBEKey pKe y =
  96                         (javax.cry pto.interf aces.PBEKe y) key;
  97                    retu rn new PBE KeySpec
  98                         (pKey.getP assword(),  pKey.getS alt(),
  99                          pKey.getI terationCo unt(), pKe y.getEncod ed().lengt h*8);
  100                } else {
  101                    thro w new Inva lidKeySpec Exception( "Invalid k ey spec");
  102                }
  103           }  else {
  104                throw ne w InvalidK eySpecExce ption("Inv alid key "  +
  105                                                      "fo rmat/algor ithm");
  106           }
  107       }
  108  
  109       /**
  110        * Tra nslates a  <code>Secr etKey</cod e> object,  whose pro vider may  be
  111        * unk nown or po tentially  untrusted,  into a co rrespondin g
  112        * <co de>SecretK ey</code>  object of  this key f actory.
  113        *
  114        * @pa ram key th e key whos e provider  is unknow n or untru sted
  115        *
  116        * @re turn the t ranslated  key
  117        *
  118        * @ex ception In validKeyEx ception if  the given  key canno t be proce ssed by
  119        * thi s key fact ory.
  120        */
  121       protec ted Secret Key engine TranslateK ey(SecretK ey key)
  122           th rows Inval idKeyExcep tion {
  123           if  ((key !=  null) &&
  124                (key.get Algorithm( ).equalsIg noreCase(" PBKDF2With HmacSHA1") ) &&
  125                (key.get Format().e qualsIgnor eCase("RAW "))) {
  126  
  127                // Check  if key or iginates f rom this f actory
  128                if (key  instanceof  com.sun.c rypto.prov ider.PBKDF 2KeyImpl)  {
  129                    retu rn key;
  130                }
  131                // Check  if key im plements t he PBEKey
  132                if (key  instanceof  javax.cry pto.interf aces.PBEKe y) {
  133                    java x.crypto.i nterfaces. PBEKey pKe y =
  134                         (javax.cry pto.interf aces.PBEKe y) key;
  135                    try  {
  136                         PBEKeySpec  spec =
  137                             new PB EKeySpec(p Key.getPas sword(),
  138                                             p Key.getSal t(),
  139                                             p Key.getIte rationCoun t(),
  140                                             p Key.getEnc oded().len gth*8);
  141                         return new  PBKDF2Key Impl(spec,  "HmacSHA1 ");
  142                    } ca tch (Inval idKeySpecE xception r e) {
  143                         InvalidKey Exception  ike = new  InvalidKey Exception
  144                             ("Inva lid key co mponent(s) ");
  145                         ike.initCa use(re);
  146                         throw ike;
  147                    }
  148                }
  149           }
  150           th row new In validKeyEx ception("I nvalid key  format/al gorithm");
  151       }
  152   }