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

Unified Diff: components/gcm_driver/crypto/p256_key_util_openssl.cc

Issue 1453503002: [NOT FOR REVIEW] Ensure contributory behaviour for Web Push encryption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@push-renames
Patch Set: Created 5 years, 1 month 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 | « components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc ('k') | crypto/ec_private_key.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/crypto/p256_key_util_openssl.cc
diff --git a/components/gcm_driver/crypto/p256_key_util_openssl.cc b/components/gcm_driver/crypto/p256_key_util_openssl.cc
index e550b15f3d6e2bebbcdef16eb1fb592da3dda8fe..848e5d3d1caf8f3a385c69300aece7122b7ef2d0 100644
--- a/components/gcm_driver/crypto/p256_key_util_openssl.cc
+++ b/components/gcm_driver/crypto/p256_key_util_openssl.cc
@@ -10,6 +10,8 @@
#include <openssl/ecdh.h>
#include <openssl/evp.h>
+#include "base/base64url.h"
+
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
@@ -45,6 +47,16 @@ bool ComputeSharedP256Secret(const base::StringPiece& private_key,
return false;
}
+ std::vector<uint8_t> pubkey;
+ local_key_pair->ExportPublicKey(&pubkey);
+
+ std::string res(reinterpret_cast<char*>(pubkey.data()), pubkey.size());
+
+ std::string b;
+ base::Base64UrlEncode(res, base::Base64UrlEncodePolicy::OMIT_PADDING, &b);
+
+ LOG(INFO) << "x509 key: [" << b << "]";
+
crypto::ScopedEC_KEY ec_private_key(
EVP_PKEY_get1_EC_KEY(local_key_pair->key()));
« no previous file with comments | « components/gcm_driver/crypto/gcm_message_cryptographer_unittest.cc ('k') | crypto/ec_private_key.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698