<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[215086] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/215086">215086</a></dd>
<dt>Author</dt> <dd>zandobersek@gmail.com</dd>
<dt>Date</dt> <dd>2017-04-07 00:36:35 -0700 (Fri, 07 Apr 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GCrypt] Implement raw and JWK imports and exports for EC keys
https://bugs.webkit.org/show_bug.cgi?id=170546
Reviewed by Michael Catanzaro.
Source/WebCore:
Implement import and export operations for EC keys, covering the raw
and JWK import/export types.
CryptoKeyEC::platformImportRaw() builds a public-key s-expression,
providing the curve name and the key data, and yields the gcry_sexp_t
object to the new CryptoKeyEC.
CryptoKeyEC::platformImportJWKPublic() first constructs a Vector<uint8_t>
object that contains the EC point in the uncompressed format. It then
puts that data into a newly-constructed public-key s-expression that is
then used to construct the new CryptoKeyEC object.
CryptoKeyEC::platformImportJWKPrivate() constructs the EC point data just
the same, but it also lays out the private key field element data into
the private-key s-expression that's then handed off to the CryptoKeyEC
object.
CryptoKeyEC::platformExportRaw() constructs a new EC operations context
and then uses it to retrieve the q parameter as an MPI. A Vector<uint8_t>
is retrieved from the MPI data through the extractMPIData() helper
function.
CryptoKeyEC::platformAddFieldElements() similarly uses the EC operations
context to retrieve the q parameter data, which it then splits into the
x and y field elements and Base64 URL-encodes them into a form that can
be placed in a JsonWebKey. If the key is private, the d parameter is
retrieved in the same fashion and again Base64 URL-encoded and stored
in the JsonWebKey object.
No new tests -- current ones cover this sufficiently, but are not yet
enabled due to other missing platform-specific SUBTLE_CRYPTO
implementations.
* crypto/gcrypt/CryptoKeyECGCrypt.cpp:
(WebCore::uncompressedPointSizeForCurve):
(WebCore::uncompressedFieldElementSizeForCurve):
(WebCore::extractMPIData):
(WebCore::CryptoKeyEC::platformImportRaw):
(WebCore::CryptoKeyEC::platformImportJWKPublic):
(WebCore::CryptoKeyEC::platformImportJWKPrivate):
(WebCore::CryptoKeyEC::platformExportRaw):
(WebCore::CryptoKeyEC::platformAddFieldElements):
Source/WebCore/PAL:
Add HandleDeleter specizalizations for gcry_ctx_t and gcry_mpi_t types.
* pal/crypto/gcrypt/Handle.h:
(PAL::GCrypt::HandleDeleter<gcry_ctx_t>::operator()):
(PAL::GCrypt::HandleDeleter<gcry_mpi_t>::operator()):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePALChangeLog">trunk/Source/WebCore/PAL/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePALpalcryptogcryptHandleh">trunk/Source/WebCore/PAL/pal/crypto/gcrypt/Handle.h</a></li>
<li><a href="#trunkSourceWebCorecryptogcryptCryptoKeyECGCryptcpp">trunk/Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (215085 => 215086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-04-07 07:35:21 UTC (rev 215085)
+++ trunk/Source/WebCore/ChangeLog        2017-04-07 07:36:35 UTC (rev 215086)
</span><span class="lines">@@ -1,5 +1,55 @@
</span><span class="cx"> 2017-04-07 Zan Dobersek <zdobersek@igalia.com>
</span><span class="cx">
</span><ins>+ [GCrypt] Implement raw and JWK imports and exports for EC keys
+ https://bugs.webkit.org/show_bug.cgi?id=170546
+
+ Reviewed by Michael Catanzaro.
+
+ Implement import and export operations for EC keys, covering the raw
+ and JWK import/export types.
+
+ CryptoKeyEC::platformImportRaw() builds a public-key s-expression,
+ providing the curve name and the key data, and yields the gcry_sexp_t
+ object to the new CryptoKeyEC.
+
+ CryptoKeyEC::platformImportJWKPublic() first constructs a Vector<uint8_t>
+ object that contains the EC point in the uncompressed format. It then
+ puts that data into a newly-constructed public-key s-expression that is
+ then used to construct the new CryptoKeyEC object.
+
+ CryptoKeyEC::platformImportJWKPrivate() constructs the EC point data just
+ the same, but it also lays out the private key field element data into
+ the private-key s-expression that's then handed off to the CryptoKeyEC
+ object.
+
+ CryptoKeyEC::platformExportRaw() constructs a new EC operations context
+ and then uses it to retrieve the q parameter as an MPI. A Vector<uint8_t>
+ is retrieved from the MPI data through the extractMPIData() helper
+ function.
+
+ CryptoKeyEC::platformAddFieldElements() similarly uses the EC operations
+ context to retrieve the q parameter data, which it then splits into the
+ x and y field elements and Base64 URL-encodes them into a form that can
+ be placed in a JsonWebKey. If the key is private, the d parameter is
+ retrieved in the same fashion and again Base64 URL-encoded and stored
+ in the JsonWebKey object.
+
+ No new tests -- current ones cover this sufficiently, but are not yet
+ enabled due to other missing platform-specific SUBTLE_CRYPTO
+ implementations.
+
+ * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
+ (WebCore::uncompressedPointSizeForCurve):
+ (WebCore::uncompressedFieldElementSizeForCurve):
+ (WebCore::extractMPIData):
+ (WebCore::CryptoKeyEC::platformImportRaw):
+ (WebCore::CryptoKeyEC::platformImportJWKPublic):
+ (WebCore::CryptoKeyEC::platformImportJWKPrivate):
+ (WebCore::CryptoKeyEC::platformExportRaw):
+ (WebCore::CryptoKeyEC::platformAddFieldElements):
+
+2017-04-07 Zan Dobersek <zdobersek@igalia.com>
+
</ins><span class="cx"> [GCrypt] Implement CryptoKeyRSA::generatePair()
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=170350
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorePALChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PAL/ChangeLog (215085 => 215086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PAL/ChangeLog        2017-04-07 07:35:21 UTC (rev 215085)
+++ trunk/Source/WebCore/PAL/ChangeLog        2017-04-07 07:36:35 UTC (rev 215086)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-04-07 Zan Dobersek <zdobersek@igalia.com>
+
+ [GCrypt] Implement raw and JWK imports and exports for EC keys
+ https://bugs.webkit.org/show_bug.cgi?id=170546
+
+ Reviewed by Michael Catanzaro.
+
+ Add HandleDeleter specizalizations for gcry_ctx_t and gcry_mpi_t types.
+
+ * pal/crypto/gcrypt/Handle.h:
+ (PAL::GCrypt::HandleDeleter<gcry_ctx_t>::operator()):
+ (PAL::GCrypt::HandleDeleter<gcry_mpi_t>::operator()):
+
</ins><span class="cx"> 2017-04-06 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r215046.
</span></span></pre></div>
<a id="trunkSourceWebCorePALpalcryptogcryptHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PAL/pal/crypto/gcrypt/Handle.h (215085 => 215086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PAL/pal/crypto/gcrypt/Handle.h        2017-04-07 07:35:21 UTC (rev 215085)
+++ trunk/Source/WebCore/PAL/pal/crypto/gcrypt/Handle.h        2017-04-07 07:36:35 UTC (rev 215086)
</span><span class="lines">@@ -91,6 +91,14 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<>
</span><ins>+struct HandleDeleter<gcry_ctx_t> {
+ void operator()(gcry_ctx_t handle)
+ {
+ gcry_ctx_release(handle);
+ }
+};
+
+template<>
</ins><span class="cx"> struct HandleDeleter<gcry_mac_hd_t> {
</span><span class="cx"> void operator()(gcry_mac_hd_t handle)
</span><span class="cx"> {
</span><span class="lines">@@ -99,6 +107,14 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<>
</span><ins>+struct HandleDeleter<gcry_mpi_t> {
+ void operator()(gcry_mpi_t handle)
+ {
+ gcry_mpi_release(handle);
+ }
+};
+
+template<>
</ins><span class="cx"> struct HandleDeleter<gcry_sexp_t> {
</span><span class="cx"> void operator()(gcry_sexp_t handle)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorecryptogcryptCryptoKeyECGCryptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp (215085 => 215086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp        2017-04-07 07:35:21 UTC (rev 215085)
+++ trunk/Source/WebCore/crypto/gcrypt/CryptoKeyECGCrypt.cpp        2017-04-07 07:36:35 UTC (rev 215086)
</span><span class="lines">@@ -29,9 +29,11 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><span class="cx"> #include "CryptoKeyPair.h"
</span><ins>+#include "JsonWebKey.h"
</ins><span class="cx"> #include "NotImplemented.h"
</span><span class="cx"> #include <pal/crypto/gcrypt/Handle.h>
</span><span class="cx"> #include <pal/crypto/gcrypt/Utilities.h>
</span><ins>+#include <wtf/text/Base64.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -55,6 +57,45 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static unsigned uncompressedPointSizeForCurve(CryptoKeyEC::NamedCurve curve)
+{
+ switch (curve) {
+ case CryptoKeyEC::NamedCurve::P256:
+ return 65;
+ case CryptoKeyEC::NamedCurve::P384:
+ return 97;
+ }
+}
+
+static unsigned uncompressedFieldElementSizeForCurve(CryptoKeyEC::NamedCurve curve)
+{
+ switch (curve) {
+ case CryptoKeyEC::NamedCurve::P256:
+ return 32;
+ case CryptoKeyEC::NamedCurve::P384:
+ return 48;
+ }
+}
+
+static Vector<uint8_t> extractMPIData(gcry_mpi_t mpi)
+{
+ size_t dataLength = 0;
+ gcry_error_t error = gcry_mpi_print(GCRYMPI_FMT_USG, nullptr, 0, &dataLength, mpi);
+ if (error != GPG_ERR_NO_ERROR) {
+ PAL::GCrypt::logError(error);
+ return { };
+ }
+
+ Vector<uint8_t> data(dataLength);
+ error = gcry_mpi_print(GCRYMPI_FMT_USG, data.data(), data.size(), nullptr, mpi);
+ if (error != GPG_ERR_NO_ERROR) {
+ PAL::GCrypt::logError(error);
+ return { };
+ }
+
+ return data;
+};
+
</ins><span class="cx"> CryptoKeyEC::~CryptoKeyEC()
</span><span class="cx"> {
</span><span class="cx"> if (m_platformKey)
</span><span class="lines">@@ -94,25 +135,68 @@
</span><span class="cx"> return CryptoKeyPair { WTFMove(publicKey), WTFMove(privateKey) };
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportRaw(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&&, bool, CryptoKeyUsageBitmap)
</del><ins>+RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportRaw(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages)
</ins><span class="cx"> {
</span><del>- notImplemented();
</del><ins>+ if (keyData.size() != uncompressedPointSizeForCurve(curve))
+ return nullptr;
</ins><span class="cx">
</span><del>- return nullptr;
</del><ins>+ PAL::GCrypt::Handle<gcry_sexp_t> platformKey;
+ gcry_error_t error = gcry_sexp_build(&platformKey, nullptr, "(public-key(ecc(curve %s)(q %b)))",
+ curveName(curve), keyData.size(), keyData.data());
+ if (error != GPG_ERR_NO_ERROR) {
+ PAL::GCrypt::logError(error);
+ return nullptr;
+ }
+
+ return create(identifier, curve, CryptoKeyType::Public, platformKey.release(), extractable, usages);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPublic(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&&, Vector<uint8_t>&&, bool, CryptoKeyUsageBitmap)
</del><ins>+RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPublic(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, bool extractable, CryptoKeyUsageBitmap usages)
</ins><span class="cx"> {
</span><del>- notImplemented();
</del><ins>+ unsigned uncompressedFieldElementSize = uncompressedFieldElementSizeForCurve(curve);
+ if (x.size() != uncompressedFieldElementSize || y.size() != uncompressedFieldElementSize)
+ return nullptr;
</ins><span class="cx">
</span><del>- return nullptr;
</del><ins>+ // Construct the Vector that represents the EC point in uncompressed format.
+ Vector<uint8_t> q;
+ q.reserveInitialCapacity(1 + 2 * uncompressedFieldElementSize);
+ q.append(0x04);
+ q.appendVector(x);
+ q.appendVector(y);
+
+ PAL::GCrypt::Handle<gcry_sexp_t> platformKey;
+ gcry_error_t error = gcry_sexp_build(&platformKey, nullptr, "(public-key(ecc(curve %s)(q %b)))",
+ curveName(curve), q.size(), q.data());
+ if (error != GPG_ERR_NO_ERROR) {
+ PAL::GCrypt::logError(error);
+ return nullptr;
+ }
+
+ return create(identifier, curve, CryptoKeyType::Public, platformKey.release(), extractable, usages);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPrivate(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&&, Vector<uint8_t>&&, Vector<uint8_t>&&, bool, CryptoKeyUsageBitmap)
</del><ins>+RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportJWKPrivate(CryptoAlgorithmIdentifier identifier, NamedCurve curve, Vector<uint8_t>&& x, Vector<uint8_t>&& y, Vector<uint8_t>&& d, bool extractable, CryptoKeyUsageBitmap usages)
</ins><span class="cx"> {
</span><del>- notImplemented();
</del><ins>+ unsigned uncompressedFieldElementSize = uncompressedFieldElementSizeForCurve(curve);
+ if (x.size() != uncompressedFieldElementSize || y.size() != uncompressedFieldElementSize || d.size() != uncompressedFieldElementSize)
+ return nullptr;
</ins><span class="cx">
</span><del>- return nullptr;
</del><ins>+ // Construct the Vector that represents the EC point in uncompressed format.
+ Vector<uint8_t> q;
+ q.reserveInitialCapacity(1 + 2 * uncompressedFieldElementSize);
+ q.append(0x04);
+ q.appendVector(x);
+ q.appendVector(y);
+
+ PAL::GCrypt::Handle<gcry_sexp_t> platformKey;
+ gcry_error_t error = gcry_sexp_build(&platformKey, nullptr, "(private-key(ecc(curve %s)(q %b)(d %b)))",
+ curveName(curve), q.size(), q.data(), d.size(), d.data());
+ if (error != GPG_ERR_NO_ERROR) {
+ PAL::GCrypt::logError(error);
+ return nullptr;
+ }
+
+ return create(identifier, curve, CryptoKeyType::Private, platformKey.release(), extractable, usages);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<CryptoKeyEC> CryptoKeyEC::platformImportSpki(CryptoAlgorithmIdentifier, NamedCurve, Vector<uint8_t>&&, bool, CryptoKeyUsageBitmap)
</span><span class="lines">@@ -131,14 +215,57 @@
</span><span class="cx">
</span><span class="cx"> Vector<uint8_t> CryptoKeyEC::platformExportRaw() const
</span><span class="cx"> {
</span><del>- notImplemented();
</del><ins>+ PAL::GCrypt::Handle<gcry_ctx_t> context;
+ gcry_error_t error = gcry_mpi_ec_new(&context, m_platformKey, nullptr);
+ if (error != GPG_ERR_NO_ERROR) {
+ PAL::GCrypt::logError(error);
+ return { };
+ }
</ins><span class="cx">
</span><del>- return { };
</del><ins>+ PAL::GCrypt::Handle<gcry_mpi_t> qMPI(gcry_mpi_ec_get_mpi("q", context, 0));
+ if (!qMPI)
+ return { };
+
+ Vector<uint8_t> q = extractMPIData(qMPI);
+ if (q.size() != uncompressedPointSizeForCurve(m_curve))
+ return { };
+
+ return q;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void CryptoKeyEC::platformAddFieldElements(JsonWebKey&) const
</del><ins>+void CryptoKeyEC::platformAddFieldElements(JsonWebKey& jwk) const
</ins><span class="cx"> {
</span><del>- notImplemented();
</del><ins>+ PAL::GCrypt::Handle<gcry_ctx_t> context;
+ gcry_error_t error = gcry_mpi_ec_new(&context, m_platformKey, nullptr);
+ if (error != GPG_ERR_NO_ERROR) {
+ PAL::GCrypt::logError(error);
+ return;
+ }
+
+ unsigned uncompressedFieldElementSize = uncompressedFieldElementSizeForCurve(m_curve);
+
+ PAL::GCrypt::Handle<gcry_mpi_t> qMPI(gcry_mpi_ec_get_mpi("q", context, 0));
+ if (qMPI) {
+ Vector<uint8_t> q = extractMPIData(qMPI);
+ if (q.size() == uncompressedPointSizeForCurve(m_curve)) {
+ Vector<uint8_t> a;
+ a.append(q.data() + 1, uncompressedFieldElementSize);
+ jwk.x = base64URLEncode(a);
+
+ Vector<uint8_t> b;
+ b.append(q.data() + 1 + uncompressedFieldElementSize, uncompressedFieldElementSize);
+ jwk.y = base64URLEncode(b);
+ }
+ }
+
+ if (type() == Type::Private) {
+ PAL::GCrypt::Handle<gcry_mpi_t> dMPI(gcry_mpi_ec_get_mpi("d", context, 0));
+ if (dMPI) {
+ Vector<uint8_t> d = extractMPIData(dMPI);
+ if (d.size() == uncompressedFieldElementSize)
+ jwk.d = base64URLEncode(d);
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Vector<uint8_t> CryptoKeyEC::platformExportSpki() const
</span></span></pre>
</div>
</div>
</body>
</html>