Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: net/cert/jwk_serializer_openssl.cc

Issue 1742873002: Switch //net to the new SPKI and PKCS#8 APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@spki-crypto
Patch Set: tweak keygen_handler_openssl.cc Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/internal/verify_signed_data_unittest.cc ('k') | net/ssl/scoped_openssl_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/jwk_serializer_openssl.cc
diff --git a/net/cert/jwk_serializer_openssl.cc b/net/cert/jwk_serializer_openssl.cc
index f5afd4fb7343cd12bd7cc8dec7a7dfba6d602fc3..12c8e4dae890afaf5bb44be6f273cfd18904e07c 100644
--- a/net/cert/jwk_serializer_openssl.cc
+++ b/net/cert/jwk_serializer_openssl.cc
@@ -5,10 +5,10 @@
#include "net/cert/jwk_serializer.h"
#include <openssl/bn.h>
+#include <openssl/bytestring.h>
#include <openssl/ec.h>
#include <openssl/ec_key.h>
#include <openssl/evp.h>
-#include <openssl/x509.h>
#include "base/base64url.h"
#include "base/logging.h"
@@ -96,10 +96,11 @@ bool ConvertSpkiFromDerToJwk(
crypto::EnsureOpenSSLInit();
crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
- const uint8_t *data = reinterpret_cast<const uint8_t*>(spki_der.data());
- const uint8_t *ptr = data;
- crypto::ScopedEVP_PKEY pubkey(d2i_PUBKEY(NULL, &ptr, spki_der.size()));
- if (!pubkey || ptr != data + spki_der.size())
+ CBS cbs;
+ CBS_init(&cbs, reinterpret_cast<const uint8_t*>(spki_der.data()),
+ spki_der.size());
+ crypto::ScopedEVP_PKEY pubkey(EVP_parse_public_key(&cbs));
+ if (!pubkey || CBS_len(&cbs) != 0)
return false;
if (pubkey->type == EVP_PKEY_EC) {
« no previous file with comments | « net/cert/internal/verify_signed_data_unittest.cc ('k') | net/ssl/scoped_openssl_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698