<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>156114</bug_id>
          
          <creation_ts>2016-04-01 11:18:10 -0700</creation_ts>
          <short_desc>WebCrypto can generate but fails to export RSA-OAEP-256 keys</short_desc>
          <delta_ts>2016-11-15 11:11:04 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>160894</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Roustem">roustem</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>jiewen_tan</cc>
    
    <cc>rob</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1179897</commentid>
    <comment_count>0</comment_count>
    <who name="Roustem">roustem</who>
    <bug_when>2016-04-01 11:18:10 -0700</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1180042</commentid>
    <comment_count>1</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2016-04-02 00:36:44 -0700</bug_when>
    <thetext>&lt;rdar://problem/25507292&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1183620</commentid>
    <comment_count>2</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2016-04-13 20:09:12 -0700</bug_when>
    <thetext>From the ChangeLog in &lt;http://trac.webkit.org/changeset/159944&gt;:

This is happening because RSA-OAEP in JWK is more limited than general WebCrypto, as JWK only allows SHA-1 as hash.

I&apos;m not sure whether that statement is correct.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1183626</commentid>
    <comment_count>3</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2016-04-13 21:22:40 -0700</bug_when>
    <thetext>It looks like we are not up-to-date with http://www.w3.org/TR/WebCryptoAPI/.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1183718</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2016-04-14 09:12:27 -0700</bug_when>
    <thetext>That statement is probably obsolete, JWK added many new identifiers since then.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1251492</commentid>
    <comment_count>5</comment_count>
    <who name="Jiewen Tan">jiewen_tan</who>
    <bug_when>2016-11-15 11:11:04 -0800</bug_when>
    <thetext>This bug should be resolved by Bug 164722.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>