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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28578</bug_id>
          
          <creation_ts>2015-04-28 17:01:22 +0000</creation_ts>
          <short_desc>No &quot;raw&quot; export/import for ECDSA</short_desc>
          <delta_ts>2015-04-28 17:04:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Web Cryptography</product>
          <component>Web Cryptography API Document</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>27447</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Martin Thomson">martin.thomson</reporter>
          <assigned_to name="Ryan Sleevi">sleevi</assigned_to>
          <cc>public-webcrypto</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>119976</commentid>
    <comment_count>0</comment_count>
    <who name="Martin Thomson">martin.thomson</who>
    <bug_when>2015-04-28 17:01:22 +0000</bug_when>
    <thetext>This is trivial to shim, but inexplicably absent from the spec.

  const SPKI_PREFIX = { 
    &quot;P-256&quot;: new Uint8Array([
      48, 86, 48, 16, 6, 4, 43, 129, 4, 112, 6, 8,
      42, 134, 72, 206, 61, 3, 1, 7, 3, 66, 0])
// add more
  };

  function importRawPublicKey(pub, alg, usages) {
    var prefix = SPKI_PREFIX[alg.namedCurve];
    var spki = new Uint8Array(prefix.byteLength + pub.byteLength);
    spki.set(prefix, 0);
    spki.set(pub, prefix.byteLength);
    return crypto.subtle.importKey(&apos;spki&apos;, spki, alg, true, usages);
  };

  function exportRawPublicKey(key, alg) {
    return crypto.subtle.exportKey(&apos;spki&apos;, key)
             .then(spki =&gt; new Uint8Array(spki, SPKI_PREFIX[alg.namedCurve]));
  };</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119977</commentid>
    <comment_count>1</comment_count>
    <who name="Martin Thomson">martin.thomson</who>
    <bug_when>2015-04-28 17:04:58 +0000</bug_when>
    <thetext>I missed this first time around.

*** This bug has been marked as a duplicate of bug 27447 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>