197. EPMO Open Source Coordination Office Redaction File Detail Report

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

197.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\security\auth\kerberos KerberosKey.java Mon Jan 22 14:46:54 2018 UTC
2 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\javax\security\auth\kerberos KerberosKey.java Wed Sep 12 17:23:19 2018 UTC

197.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 11 584
Changed 10 24
Inserted 0 0
Removed 0 0

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

197.4 Active regular expressions

No regular expressions were active.

197.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 200 0, 2013, 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.securi ty.auth.ke rberos;
  27  
  28   import jav a.util.Arr ays;
  29   import jav ax.crypto. SecretKey;
  30   import jav ax.securit y.auth.Des troyable;
  31   import jav ax.securit y.auth.Des troyFailed Exception;
  32  
  33   /**
  34    * This cl ass encaps ulates a l ong term  PW        key for a  Kerberos
  35    * princip al.<p>
  36    *
  37    * All Ker beros JAAS  login mod ules that  obtain a p rincipal's  password  and
  38    * generat e the  PW        key from i t should u se this cl ass.
  39    * Sometim es, such a s when aut henticatin g a server  in
  40    * the abs ence of us er-to-user  authentic ation, the  login mod ule will s tore
  41    * an inst ance of th is class i n the priv ate creden tial set o f a
  42    * {@link  javax.secu rity.auth. Subject Su bject} dur ing the co mmit phase  of the
  43    * authent ication pr ocess.<p>
  44    *
  45    * A Kerbe ros servic e using a  keytab to  read  PW        keys shoul d use
  46    * the {@l ink KeyTab } class, w here lates t keys can  be read w hen needed .<p>
  47    *
  48    * It migh t be neces sary for t he applica tion to be  granted a
  49    * {@link  javax.secu rity.auth. PrivateCre dentialPer mission
  50    * Private Credential Permission } if it ne eds to acc ess the Ke rberosKey
  51    * instanc e from a S ubject. Th is permiss ion is not  needed wh en the
  52    * applica tion depen ds on the  default JG SS Kerbero s mechanis m to acces s the
  53    * Kerbero sKey. In t hat case,  however, t he applica tion will  need an
  54    * appropr iate
  55    * {@link  javax.secu rity.auth. kerberos.S ervicePerm ission Ser vicePermis sion}.
  56    *
  57    * @author  Mayank Up adhyay
  58    * @since  1.4
  59    */
  60   public cla ss Kerbero sKey imple ments Secr etKey, Des troyable {
  61  
  62       privat e static f inal long  serialVers ionUID = - 4625402278 148246993L ;
  63  
  64      /**
  65          * The prin cipal that  this  PW        key belong s to.
  66        *
  67        * @se rial
  68        */
  69       privat e Kerberos Principal  principal;
  70  
  71      /**
  72          * the vers ion number  of this  PW        key
  73        *
  74        * @se rial
  75        */
  76       privat e int vers ionNum;
  77  
  78      /**
  79       * {@co de KeyImpl } is seria lized by w riting out  the ASN1  Encoded by tes
  80       * of t he encrypt ion key.
  81       * The  ASN1 encod ing is def ined in RF C4120 and  as  follow s:
  82       * <pre >
  83       * Encr yptionKey    ::= SEQU ENCE {
  84       *            keyt ype   [0]  Int32 -- a ctually en cryption t ype --,
  85       *            keyv alue  [1]  OCTET STRI NG
  86       * }
  87       * </pr e>
  88       *
  89       * @ser ial
  90       */
  91  
  92       privat e KeyImpl  key;
  93       privat e transien t boolean  destroyed  = false;
  94  
  95       /**
  96        * Con structs a  KerberosKe y from the  given byt es when th e key type  and
  97          * key vers ion number  are known . This can  be used w hen readin g the  PW     
  98        * key  informati on from a  Kerberos " keytab".
  99        *
  100          * @param p rincipal t he princip al that th is  PW        key belong s to
  101          * @param k eyBytes th e raw byte s for the  PW        key
  102          * @param k eyType the  key type  for the  PW        key as def ined by th e
  103        * Ker beros prot ocol speci fication.
  104          * @param v ersionNum  the versio n number o f this  PW        key
  105        */
  106       public  KerberosK ey(Kerbero sPrincipal  principal ,
  107                            byte[]  keyBytes,
  108                            int key Type,
  109                            int ver sionNum) {
  110           th is.princip al = princ ipal;
  111           th is.version Num = vers ionNum;
  112           ke y = new Ke yImpl(keyB ytes, keyT ype);
  113       }
  114  
  115       /**
  116        * Con structs a  KerberosKe y from a p rincipal's  password.
  117        *
  118        * @pa ram princi pal the pr incipal th at this pa ssword bel ongs to
  119        * @pa ram passwo rd the pas sword that  should be  used to c ompute the  key
  120        * @pa ram algori thm the na me for the  algorithm  that this  key will  be
  121        * use d for. Thi s paramete r may be n ull in whi ch case th e default
  122        * alg orithm "DE S" will be  assumed.
  123        * @th rows Illeg alArgument Exception  if the nam e of the
  124        * alg orithm pas sed is uns upported.
  125        */
  126       public  KerberosK ey(Kerbero sPrincipal  principal ,
  127                            char[]  password,
  128                            String  algorithm)  {
  129  
  130           th is.princip al = princ ipal;
  131           //  Pass prin cipal in f or salt
  132           ke y = new Ke yImpl(prin cipal, pas sword, alg orithm);
  133       }
  134  
  135       /**
  136        * Ret urns the p rincipal t hat this k ey belongs  to.
  137        *
  138        * @re turn the p rincipal t his key be longs to.
  139        */
  140       public  final Ker berosPrinc ipal getPr incipal()  {
  141           if  (destroye d)
  142                throw ne w IllegalS tateExcept ion("This  key is no  longer val id");
  143           re turn princ ipal;
  144       }
  145  
  146       /**
  147        * Ret urns the k ey version  number.
  148        *
  149        * @re turn the k ey version  number.
  150        */
  151       public  final int  getVersio nNumber()  {
  152           if  (destroye d)
  153                throw ne w IllegalS tateExcept ion("This  key is no  longer val id");
  154           re turn versi onNum;
  155       }
  156  
  157       /**
  158        * Ret urns the k ey type fo r this lon g-term key .
  159        *
  160        * @re turn the k ey type.
  161        */
  162       public  final int  getKeyTyp e() {
  163           if  (destroye d)
  164                throw ne w IllegalS tateExcept ion("This  key is no  longer val id");
  165           re turn key.g etKeyType( );
  166       }
  167  
  168       /*
  169        * Met hods from  java.secur ity.Key
  170        */
  171  
  172       /**
  173        * Ret urns the s tandard al gorithm na me for thi s key. For
  174        * exa mple, "DES " would in dicate tha t this key  is a DES  key.
  175        * See  Appendix  A in the < a href=
  176        * ".. /../../../ ../technot es/guides/ security/c rypto/Cryp toSpec.htm l#AppA">
  177        * Jav a Cryptogr aphy Archi tecture AP I Specific ation &amp ; Referenc e
  178        * </a >
  179        * for  informati on about s tandard al gorithm na mes.
  180        *
  181        * @re turn the n ame of the  algorithm  associate d with thi s key.
  182        */
  183       public  final Str ing getAlg orithm() {
  184           if  (destroye d)
  185                throw ne w IllegalS tateExcept ion("This  key is no  longer val id");
  186           re turn key.g etAlgorith m();
  187       }
  188  
  189       /**
  190          * Returns  the name o f the enco ding forma t for this   PW        key.
  191        *
  192        * @re turn the S tring "RAW "
  193        */
  194       public  final Str ing getFor mat() {
  195           if  (destroye d)
  196                throw ne w IllegalS tateExcept ion("This  key is no  longer val id");
  197           re turn key.g etFormat() ;
  198       }
  199  
  200       /**
  201          * Returns  the key ma terial of  this  PW        key.
  202        *
  203        * @re turn the k ey materia l
  204        */
  205       public  final byt e[] getEnc oded() {
  206           if  (destroye d)
  207                throw ne w IllegalS tateExcept ion("This  key is no  longer val id");
  208           re turn key.g etEncoded( );
  209       }
  210  
  211       /**
  212        * Des troys this  key. A ca ll to any  of its oth er methods  after thi s
  213        * wil l cause an   IllegalS tateExcept ion to be  thrown.
  214        *
  215        * @th rows Destr oyFailedEx ception if  some erro r occurs w hile desto rying
  216        * thi s key.
  217        */
  218       public  void dest roy() thro ws Destroy FailedExce ption {
  219           if  (!destroy ed) {
  220                key.dest roy();
  221                principa l = null;
  222                destroye d = true;
  223           }
  224       }
  225  
  226  
  227       /** De termines i f this key  has been  destroyed. */
  228       public  boolean i sDestroyed () {
  229           re turn destr oyed;
  230       }
  231  
  232       public  String to String() {
  233           if  (destroye d) {
  234                return " Destroyed  Principal" ;
  235           }
  236           re turn "Kerb eros Princ ipal " + p rincipal.t oString()  +
  237                    "Key  Version "  + version Num +
  238                    "key  "  + key. toString() ;
  239       }
  240  
  241       /**
  242        * Ret urns a has hcode for  this Kerbe rosKey.
  243        *
  244        * @re turn a has hCode() fo r the {@co de Kerbero sKey}
  245        * @si nce 1.6
  246        */
  247       public  int hashC ode() {
  248           in t result =  17;
  249           if  (isDestro yed()) {
  250                return r esult;
  251           }
  252           re sult = 37  * result +  Arrays.ha shCode(get Encoded()) ;
  253           re sult = 37  * result +  getKeyTyp e();
  254           if  (principa l != null)  {
  255                result =  37 * resu lt + princ ipal.hashC ode();
  256           }
  257           re turn resul t * 37 + v ersionNum;
  258       }
  259  
  260       /**
  261        * Com pares the  specified  Object wit h this Ker berosKey f or equalit y.
  262        * Ret urns true  if the giv en object  is also a
  263        * {@c ode Kerber osKey} and  the two
  264        * {@c ode Kerber osKey} ins tances are  equivalen t.
  265        *
  266        * @pa ram other  the Object  to compar e to
  267        * @re turn true  if the spe cified obj ect is equ al to this  KerberosK ey,
  268        * fal se otherwi se. NOTE:  Returns fa lse if eit her of the  KerberosK ey
  269        * obj ects has b een destro yed.
  270        * @si nce 1.6
  271        */
  272       public  boolean e quals(Obje ct other)  {
  273  
  274           if  (other ==  this)
  275                return t rue;
  276  
  277           if  (! (other  instanceo f Kerberos Key)) {
  278                return f alse;
  279           }
  280  
  281           Ke rberosKey  otherKey =  ((Kerbero sKey) othe r);
  282           if  (isDestro yed() || o therKey.is Destroyed( )) {
  283                return f alse;
  284           }
  285  
  286           if  (versionN um != othe rKey.getVe rsionNumbe r() ||
  287                    getK eyType() ! = otherKey .getKeyTyp e() ||
  288                    !Arr ays.equals (getEncode d(), other Key.getEnc oded())) {
  289                return f alse;
  290           }
  291  
  292           if  (principa l == null)  {
  293                if (othe rKey.getPr incipal()  != null) {
  294                    retu rn false;
  295                }
  296           }  else {
  297                if (!pri ncipal.equ als(otherK ey.getPrin cipal()))  {
  298                    retu rn false;
  299                }
  300           }
  301  
  302           re turn true;
  303       }
  304   }