233. EPMO Open Source Coordination Office Redaction File Detail Report

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

233.1 Files compared

# Location File Last Modified
1 build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\sun\security\ec ECDHKeyAgreement.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\sun\security\ec ECDHKeyAgreement.java Wed Sep 12 17:51:27 2018 UTC

233.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 7 334
Changed 6 20
Inserted 0 0
Removed 0 0

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

233.4 Active regular expressions

No regular expressions were active.

233.5 Comparison detail

  1   /*
  2    * Copyrig ht (c) 200 9, 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 su n.security .ec;
  27  
  28   import jav a.security .*;
  29   import jav a.security .interface s.*;
  30   import jav a.security .spec.*;
  31  
  32   import jav ax.crypto. *;
  33   import jav ax.crypto. spec.*;
  34  
  35   import sun .security. util.ECUti l;
  36  
  37   /**
  38    * KeyAgre ement impl ementation  for ECDH.
  39    *
  40    * @since    1.7
  41    */
  42   public fin al class E CDHKeyAgre ement exte nds KeyAgr eementSpi  {
  43  
  44       // pri vate key,  if initial ized
  45       privat e ECPrivat eKey priva teKey;
  46  
  47       // enc oded publi c point, n on-null be tween doPh ase() & ge nerateSecr et() only
  48       privat e byte[] p ublicValue ;
  49  
  50         // length  of the  PW        to be deri ved
  51         private in PW      Len;
  52  
  53       /**
  54        * Con structs a  new ECDHKe yAgreement .
  55        */
  56       public  ECDHKeyAg reement()  {
  57       }
  58  
  59       // see  JCE spec
  60       @Overr ide
  61       protec ted void e ngineInit( Key key, S ecureRando m random)
  62                throws I nvalidKeyE xception {
  63           if  (!(key in stanceof P rivateKey) ) {
  64                throw ne w InvalidK eyExceptio n
  65                             ("Key  must be in stance of  PrivateKey ");
  66           }
  67           pr ivateKey =  (ECPrivat eKey) ECKe yFactory.t oECKey(key );
  68           pu blicValue  = null;
  69       }
  70  
  71       // see  JCE spec
  72       @Overr ide
  73       protec ted void e ngineInit( Key key, A lgorithmPa rameterSpe c params,
  74                SecureRa ndom rando m) throws  InvalidKey Exception,
  75                InvalidA lgorithmPa rameterExc eption {
  76           if  (params ! = null) {
  77                throw ne w InvalidA lgorithmPa rameterExc eption
  78                             ("Para meters not  supported ");
  79           }
  80           en gineInit(k ey, random );
  81       }
  82  
  83       // see  JCE spec
  84       @Overr ide
  85       protec ted Key en gineDoPhas e(Key key,  boolean l astPhase)
  86                throws I nvalidKeyE xception,  IllegalSta teExceptio n {
  87           if  (privateK ey == null ) {
  88                throw ne w IllegalS tateExcept ion("Not i nitialized ");
  89           }
  90           if  (publicVa lue != nul l) {
  91                throw ne w IllegalS tateExcept ion("Phase  already e xecuted");
  92           }
  93           if  (!lastPha se) {
  94                throw ne w IllegalS tateExcept ion
  95                    ("On ly two par ty agreeme nt support ed, lastPh ase must b e true");
  96           }
  97           if  (!(key in stanceof E CPublicKey )) {
  98                throw ne w InvalidK eyExceptio n
  99                    ("Ke y must be  a PublicKe y with alg orithm EC" );
  100           }
  101  
  102           EC PublicKey  ecKey = (E CPublicKey )key;
  103           EC ParameterS pec params  = ecKey.g etParams() ;
  104  
  105           if  (ecKey in stanceof E CPublicKey Impl) {
  106                publicVa lue = ((EC PublicKeyI mpl)ecKey) .getEncode dPublicVal ue();
  107           }  else { //  instanceof  ECPublicK ey
  108                publicVa lue =
  109                    ECUt il.encodeP oint(ecKey .getW(), p arams.getC urve());
  110           }
  111           in t keyLenBi ts = param s.getCurve ().getFiel d().getFie ldSize();
  112             PW      Len = (key LenBits +  7) >> 3;
  113  
  114           re turn null;
  115       }
  116  
  117       // see  JCE spec
  118       @Overr ide
  119       protec ted byte[]  engineGen erateSecre t() throws  IllegalSt ateExcepti on {
  120           if  ((private Key == nul l) || (pub licValue = = null)) {
  121                throw ne w IllegalS tateExcept ion("Not i nitialized  correctly ");
  122           }
  123  
  124           by te[] s = p rivateKey. getS().toB yteArray() ;
  125           by te[] encod edParams =                     / / DER OID
  126                ECUtil.e ncodeECPar ameterSpec (null, pri vateKey.ge tParams()) ;
  127  
  128           tr y {
  129  
  130                return d eriveKey(s , publicVa lue, encod edParams);
  131  
  132           }  catch (Gen eralSecuri tyExceptio n e) {
  133                throw ne w Provider Exception( "Could not  derive ke y", e);
  134           }
  135  
  136       }
  137  
  138       // see  JCE spec
  139       @Overr ide
  140       protec ted int en gineGenera teSecret(b yte[] shar edSecret,  int
  141                offset)  throws Ill egalStateE xception,  ShortBuffe rException  {
  142             if (offset  +  PW      Len > shar edSecret.l ength) {
  143                  throw new  ShortBuffe rException ("Need " +   PW      Len
  144                    + "  bytes, onl y " + (sha redSecret. length - o ffset) + "  available ");
  145           }
  146             byte[]  PW        = engineGe nerateSecr et();
  147             System.arr aycopy( PW      , 0, share dSecret, o ffset,  PW      .length);
  148             return  PW      .length;
  149       }
  150  
  151       // see  JCE spec
  152       @Overr ide
  153       protec ted Secret Key engine GenerateSe cret(Strin g algorith m)
  154                throws I llegalStat eException , NoSuchAl gorithmExc eption,
  155                InvalidK eyExceptio n {
  156           if  (algorith m == null)  {
  157                throw ne w NoSuchAl gorithmExc eption("Al gorithm mu st not be  null");
  158           }
  159           if  (!(algori thm.equals ("TlsPrema sterSecret "))) {
  160                throw ne w NoSuchAl gorithmExc eption
  161                    ("On ly support ed for alg orithm Tls PremasterS ecret");
  162           }
  163           re turn new S ecretKeySp ec(engineG enerateSec ret(), "Tl sPremaster Secret");
  164       }
  165  
  166       /**
  167          * Generate s a  PW        key using  the public  and priva te keys.
  168        *
  169        * @pa ram s the  private ke y's S valu e.
  170        * @pa ram w the  public key 's W point  (in uncom pressed fo rm).
  171        * @pa ram encode dParams th e curve's  DER encode d object i dentifier.
  172        *
  173          * @return  byte[] the   PW        key.
  174        */
  175       privat e static n ative byte [] deriveK ey(byte[]  s, byte[]  w,
  176           by te[] encod edParams)  throws Gen eralSecuri tyExceptio n;
  177   }