<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>On 9/22/2017 1:27 AM, Anders Rundgren wrote:<br>
    </p>
    <blockquote type="cite"
      cite="mid:2d775c71-a6fd-8b89-6c75-b01775c16617@gmail.com">On
      2017-09-21 17:25, Adam Petcher wrote:
      <br>
      <blockquote type="cite">I would like to leave this open for
        feedback for another week or so.
        <br>
        Please reply with your comments by Saturday, September 30, end
        of day,
        <br>
        anywhere on earth. After that time, I plan to move on to the
        next phase
        <br>
        of the process (group lead and architect review prior to
        submission).
        <br>
      </blockquote>
      <br>
      This proposal doesn't appear fundamentally different than the one
      I drafted on
      <br>
      <a class="moz-txt-link-freetext" href="https://github.com/cyberphone/java-cfrg-spec">https://github.com/cyberphone/java-cfrg-spec</a> sometimes ago.
      <br>
      <br>
      So I'm obviously OK with that but still have a question: How do
      you envision
      <br>
      the corresponding signature algorithms will be supported?  IMO, it
      would
      <br>
      be useful knowing that before casting things in concrete.
      <br>
    </blockquote>
    <br>
    After the last round of API review, I developed an initial API
    design (and prototype implementation) for EdDSA to help address
    questions like this. I'll share a summary of the initial EdDSA API
    design for the purpose of evaluating the X25519/X448 JEP, but please
    don't pay too much attention to the details. We will review the
    EdDSA API separately in the future.<br>
    <br>
    The EdDSA API will be similar to the X25519/X448 design. We can use
    the string "EdDSA" to identify the algorithm across all services.
    There are some naming issues to sort out for EdDSA, especially
    related to algorithm variants and selection of hash functions. These
    issues don't seem to impact X25519/X448, so we can sort them out
    later. <br>
    <br>
    We will develop interfaces and key specs for EdDSA public/private
    keys, with a structure that is similar to the one in XDH. Private
    keys will be represented using byte arrays. Public keys are points,
    and it would probably be best to add a new class for compressed
    Edwards curve points (which have a BigInteger y coordinate and a
    boolean for the x coordinate), but there may be other good options
    here. <br>
    <br>
    EdDSA has some additional algorithm parameters, such as the variant
    (pure, pre-hash, or context) and the context value. So we would need
    an EdDSAParameterSpec class to hold these parameters along with the
    curve parameters. The curve parameters will be stored in the
    EdDSAParameterSpec as an AlgorithmParameterSpec, allowing them to be
    specified using a NamedParameterSpec or any other method of
    specifying an Edwards curve. <br>
    <br>
    <br>
    <blockquote type="cite"
      cite="mid:2d775c71-a6fd-8b89-6c75-b01775c16617@gmail.com">
      <br>
      Just for my curiosity, if somebody wanted to implement other
      variants of
      <br>
      XDH curves, would the proper way to do that be through using a new
      <br>
      provider name (like "XDH-1") while still using the XDH classes and
      <br>
      interfaces?
      <br>
    </blockquote>
    <br>
    If a provider wants to support some other curve, then a simple way
    to do this would be to use the algorithm name "XDH", and specify the
    name of the curve in the NamedParameterSpec. All of the XDH key
    interfaces and spec classes can still be used. This is similar to
    how providers support different named curves using
    ECGenParameterSpec today. Example client code (using a hypothetical
    named curve "X480"):<br>
    <br>
    <pre class="prettyprint"><code>KeyPairGenerator kpg = KeyPairGenerator.getInstance("XDH");
NamedParameterSpec paramSpec = new NamedParameterSpec("X480");
kpg.initialize(paramSpec); 
KeyPair kp = kpg.generateKeyPair();

KeyFactory kf = KeyFactory.getInstance("XDH");
BigInteger u = ...
XDHPublicKeySpec pubSpec = new XDHPublicKeySpec(paramSpec, u);
PublicKey pubKey = kf.generatePublic(pubSpec);

KeyAgreement ka = KeyAgreement.getInstance("XDH");
ka.init(kp.getPrivate());
ka.doPhase(pubKey, true);
byte[] secret = ka.generateSecret();</code></pre>
    <br>
    Using a different algorithm name may also be a reasonable option,
    since you could simply define (for example) "X480" as an algorithm.
    But this is similar to the example above, and the provider should
    probably define "X480" as "XDH" initialized with the "X480"
    NamedParameterSpec. <br>
    <br>
    <blockquote type="cite"
      cite="mid:2d775c71-a6fd-8b89-6c75-b01775c16617@gmail.com">
      <br>
      Anders
      <br>
      <br>
      <br>
      <blockquote type="cite">
        <br>
        <br>
        On 9/14/2017 12:59 PM, Adam Petcher wrote:
        <br>
        <blockquote type="cite">The JEP for X25519/X448 key agreement[1]
          is now available and ready to
          <br>
          review. Please take a look and reply with any feedback you
          have.
          <br>
          <br>
          The JEP contains a description of the proposed JCA API. We
          have
          <br>
          discussed the API on this mailing list, and I have attempted
          to
          <br>
          incorporate all the feedback I have received. Here is a
          description of
          <br>
          the changes since the last discussion:
          <br>
          <br>
          1) Multiple people requested more specific types for
          public/private
          <br>
          keys for this algorithm. The latest API design mirrors the
          "EC"
          <br>
          hierarchy and has both interfaces and spec classes for public
          and
          <br>
          private keys. I also added the interface "XDHKey", which
          serves the
          <br>
          same purpose as "ECKey".
          <br>
          2) The representation of public keys was changed from byte[]
          to a
          <br>
          BigInteger which holds the u coordinate of the point. Private
          keys are
          <br>
          still represented using byte[] due to complications related to
          <br>
          pruning, and also because BigInteger doesn't provide a
          branch-free way
          <br>
          to get the key into another representation (which is necessary
          for
          <br>
          side-channel-resilient implementations).
          <br>
          <br>
          The proposed API still lacks a standard way to specify
          arbitrary
          <br>
          domain parameters, but I believe the API design could be
          extended to
          <br>
          support this feature. I would prefer to add this API as a
          separate
          <br>
          enhancement in the future, preferably in cooperation with
          someone who
          <br>
          is developing a provider that supports this feature.
          <br>
          <br>
          <br>
          [1] <a class="moz-txt-link-freetext" href="https://bugs.openjdk.java.net/browse/JDK-8181595">https://bugs.openjdk.java.net/browse/JDK-8181595</a>
          <br>
          <br>
        </blockquote>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>