178. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 9/25/2018 2:13:10 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.

178.1 Files compared

# Location File Last Modified
1 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\javax\crypto\spec PBEKeySpec.java Mon Jan 22 14:46:52 2018 UTC
2 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\javax\crypto\spec PBEKeySpec.java Wed Sep 12 17:18:46 2018 UTC

178.2 Comparison summary

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

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

178.4 Active regular expressions

No regular expressions were active.

178.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 199 7, 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 ja vax.crypto .spec;
  27  
  28   import jav a.security .spec.KeyS pec;
  29  
  30   /**
  31    * A user- chosen pas sword that  can be us ed with pa ssword-bas ed encrypt ion
  32    * (<i>PBE </i>).
  33    *
  34    * <p>The  password c an be view ed as some  kind of r aw key mat erial, fro m which
  35    * the enc ryption me chanism th at uses it  derives a  cryptogra phic key.
  36    *
  37    * <p>Diff erent PBE  mechanisms  may consu me differe nt bits of  each pass word
  38    * charact er. For ex ample, the  PBE mecha nism defin ed in
  39    * <a href ="http://w ww.ietf.or g/rfc/rfc2 898.txt">
  40    * PKCS #5 </a> looks  at only t he low ord er 8 bits  of each ch aracter, w hereas
  41    * PKCS #1 2 looks at  all 16 bi ts of each  character .
  42    *
  43    * <p>You  convert th e password  character s to a PBE  key by cr eating an
  44    * instanc e of the a ppropriate   PW      -key facto ry. For ex ample, a  PW      -key
  45    * factory  for PKCS  #5 will co nstruct a  PBE key fr om only th e low orde r 8 bits
  46    * of each  password  character,  whereas a   PW      -key facto ry for PKC S #12 will
  47    * take al l 16 bits  of each ch aracter.
  48    *
  49    * <p>Also  note that  this clas s stores p asswords a s char arr ays instea d of
  50    * <code>S tring</cod e> objects  (which wo uld seem m ore logica l), becaus e the
  51    * String  class is i mmutable a nd there i s no way t o overwrit e its
  52    * interna l value wh en the pas sword stor ed in it i s no longe r needed.  Hence,
  53    * this cl ass reques ts the pas sword as a  char arra y, so it c an be over written
  54    * when do ne.
  55    *
  56    * @author  Jan Luehe
  57    * @author  Valerie P eng
  58    *
  59    * @see ja vax.crypto .SecretKey Factory
  60    * @see PB EParameter Spec
  61    * @since  1.4
  62    */
  63   public cla ss PBEKeyS pec implem ents KeySp ec {
  64  
  65       privat e char[] p assword;
  66       privat e byte[] s alt = null ;
  67       privat e int iter ationCount  = 0;
  68       privat e int keyL ength = 0;
  69  
  70       /**
  71        * Con structor t hat takes  a password . An empty  char[] is  used if
  72        * nul l is speci fied.
  73        *
  74        * <p>  Note: <co de>passwor d</code> i s cloned b efore it i s stored i n
  75        * the  new <code >PBEKeySpe c</code> o bject.
  76        *
  77        * @pa ram passwo rd the pas sword.
  78        */
  79       public  PBEKeySpe c(char[] p assword) {
  80           if  ((passwor d == null)  || (passw ord.length  == 0)) {
  81                this.pas sword = ne w char[0];
  82           }  else {
  83                this.pas sword = pa ssword.clo ne();
  84           }
  85       }
  86  
  87  
  88       /**
  89        * Con structor t hat takes  a password , salt, it eration co unt, and
  90        * to- be-derived  key lengt h for gene rating PBE Key of var iable-key- size
  91        * PBE  ciphers.   An empty  char[] is  used if nu ll is spec ified for
  92        * <co de>passwor d</code>.
  93        *
  94        * <p>  Note: the  <code>pas sword</cod e> and <co de>salt</c ode>
  95        * are  cloned be fore they  are stored  in
  96        * the  new <code >PBEKeySpe c</code> o bject.
  97        *
  98        * @pa ram passwo rd the pas sword.
  99        * @pa ram salt t he salt.
  100        * @pa ram iterat ionCount t he iterati on count.
  101        * @pa ram keyLen gth the to -be-derive d key leng th.
  102        * @ex ception Nu llPointerE xception i f <code>sa lt</code>  is null.
  103        * @ex ception Il legalArgum entExcepti on if <cod e>salt</co de> is emp ty,
  104        * i.e . 0-length , <code>it erationCou nt</code>  or
  105        * <co de>keyLeng th</code>  is not pos itive.
  106        */
  107       public  PBEKeySpe c(char[] p assword, b yte[] salt , int iter ationCount ,
  108           in t keyLengt h) {
  109           if  ((passwor d == null)  || (passw ord.length  == 0)) {
  110                this.pas sword = ne w char[0];
  111           }  else {
  112                this.pas sword = pa ssword.clo ne();
  113           }
  114           if  (salt ==  null) {
  115                throw ne w NullPoin terExcepti on("the sa lt paramet er " +
  116                                                   "must  be non-nul l");
  117           }  else if (s alt.length  == 0) {
  118                throw ne w IllegalA rgumentExc eption("th e salt par ameter " +
  119                                                       "m ust not be  empty");
  120           }  else {
  121                this.sal t = salt.c lone();
  122           }
  123           if  (iteratio nCount<=0)  {
  124                throw ne w IllegalA rgumentExc eption("in valid iter ationCount  value");
  125           }
  126           if  (keyLengt h<=0) {
  127                throw ne w IllegalA rgumentExc eption("in valid keyL ength valu e");
  128           }
  129           th is.iterati onCount =  iterationC ount;
  130           th is.keyLeng th = keyLe ngth;
  131       }
  132  
  133  
  134       /**
  135        * Con structor t hat takes  a password , salt, it eration co unt for
  136        * gen erating PB EKey of fi xed-key-si ze PBE cip hers. An e mpty
  137        * cha r[] is use d if null  is specifi ed for <co de>passwor d</code>.
  138        *
  139        * <p>  Note: the  <code>pas sword</cod e> and <co de>salt</c ode>
  140        * are  cloned be fore they  are stored  in the ne w
  141        * <co de>PBEKeyS pec</code>  object.
  142        *
  143        * @pa ram passwo rd the pas sword.
  144        * @pa ram salt t he salt.
  145        * @pa ram iterat ionCount t he iterati on count.
  146        * @ex ception Nu llPointerE xception i f <code>sa lt</code>  is null.
  147        * @ex ception Il legalArgum entExcepti on if <cod e>salt</co de> is emp ty,
  148        * i.e . 0-length , or <code >iteration Count</cod e> is not  positive.
  149        */
  150       public  PBEKeySpe c(char[] p assword, b yte[] salt , int iter ationCount ) {
  151           if  ((passwor d == null)  || (passw ord.length  == 0)) {
  152                this.pas sword = ne w char[0];
  153           }  else {
  154                this.pas sword = pa ssword.clo ne();
  155           }
  156           if  (salt ==  null) {
  157                throw ne w NullPoin terExcepti on("the sa lt paramet er " +
  158                                                   "must  be non-nul l");
  159           }  else if (s alt.length  == 0) {
  160                throw ne w IllegalA rgumentExc eption("th e salt par ameter " +
  161                                                       "m ust not be  empty");
  162           }  else {
  163                this.sal t = salt.c lone();
  164           }
  165           if  (iteratio nCount<=0)  {
  166                throw ne w IllegalA rgumentExc eption("in valid iter ationCount  value");
  167           }
  168           th is.iterati onCount =  iterationC ount;
  169       }
  170  
  171       /**
  172        * Cle ars the in ternal cop y of the p assword.
  173        *
  174        */
  175       public  final voi d clearPas sword() {
  176           if  (password  != null)  {
  177                for (int  i = 0; i  < password .length; i ++) {
  178                    pass word[i] =  ' ';
  179                }
  180                password  = null;
  181           }
  182       }
  183  
  184       /**
  185        * Ret urns a cop y of the p assword.
  186        *
  187        * <p>  Note: thi s method r eturns a c opy of the  password.  It is
  188        * the  caller's  responsibi lity to ze ro out the  password  informatio n after
  189        * it  is no long er needed.
  190        *
  191        * @ex ception Il legalState Exception  if passwor d has been  cleared b y
  192        * cal ling <code >clearPass word</code > method.
  193        * @re turn the p assword.
  194        */
  195       public  final cha r[] getPas sword() {
  196           if  (password  == null)  {
  197                throw ne w IllegalS tateExcept ion("passw ord has be en cleared ");
  198           }
  199           re turn passw ord.clone( );
  200       }
  201  
  202       /**
  203        * Ret urns a cop y of the s alt or nul l if not s pecified.
  204        *
  205        * <p>  Note: thi s method s hould retu rn a copy  of the sal t. It is
  206        * the  caller's  responsibi lity to ze ro out the  salt info rmation af ter
  207        * it  is no long er needed.
  208        *
  209        * @re turn the s alt.
  210        */
  211       public  final byt e[] getSal t() {
  212           if  (salt !=  null) {
  213                return s alt.clone( );
  214           }  else {
  215                return n ull;
  216           }
  217       }
  218  
  219       /**
  220        * Ret urns the i teration c ount or 0  if not spe cified.
  221        *
  222        * @re turn the i teration c ount.
  223        */
  224       public  final int  getIterat ionCount()  {
  225           re turn itera tionCount;
  226       }
  227  
  228       /**
  229        * Ret urns the t o-be-deriv ed key len gth or 0 i f not spec ified.
  230        *
  231        * <p>  Note: thi s is used  to indicat e the pref erence on  key length
  232        * for  variable- key-size c iphers. Th e actual k ey size de pends on
  233        * eac h provider 's impleme ntation.
  234        *
  235        * @re turn the t o-be-deriv ed key len gth.
  236        */
  237       public  final int  getKeyLen gth() {
  238           re turn keyLe ngth;
  239       }
  240   }