<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - WebCrypto can generate but fails to export RSA-OAEP-256 keys"
   href="https://bugs.webkit.org/show_bug.cgi?id=156114">156114</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>WebCrypto can generate but fails to export RSA-OAEP-256 keys
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Safari Technology Preview
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>WebCore Misc.
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>roustem&#64;agilebits.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>crypto.webkitSubtle.generateKey({
            name: &quot;RSA-OAEP&quot;,
            modulusLength: 2048,
            publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
            hash: {name: &quot;SHA-256&quot;}
        }, true, [&quot;encrypt&quot;, &quot;decrypt&quot; ]).then((keypair) =&gt; {
            console.log(&quot;Generated Key Pair:&quot;, keypair);
            return crypto.webkitSubtle.exportKey(&quot;jwk&quot;, keypair.publicKey);
        }).then((keydata) =&gt; {
            console.log(&quot;Key Data:&quot;, keydata);
        }).catch((error) =&gt; {
            console.log(&quot;Error: &quot;, error);
        });


The code above should be able log both the newly Generated Key Pair and also log the Key Data.

It successfully generates the key pair:

[Log] Generated Key Pair: – KeyPair {publicKey: Key, privateKey: Key}
KeyPair {publicKey: Key, privateKey: Key}KeyPairprivateKey: Key {type: &quot;private&quot;, extractable: true, algorithm: Object, usages: [&quot;decrypt&quot;, &quot;encrypt&quot;]}KeypublicKey: Key {type: &quot;public&quot;, extractable: true, algorithm: Object, usages: [&quot;decrypt&quot;, &quot;encrypt&quot;]}KeyKeyPair Prototype

But not able to export it:

[Log] Error: 
TypeError: Key algorithm and size do not map to any JWK algorithm identifier
exportKey
promiseReactionJob</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>