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

Side by Side Diff: net/base/openssl_private_key_store_android.cc

Issue 2536993002: Remove support for the keygen tag (Closed)
Patch Set: Rebased Created 3 years, 12 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 unified diff | Download patch
« no previous file with comments | « net/base/openssl_private_key_store.h ('k') | net/base/openssl_private_key_store_memory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/base/openssl_private_key_store.h"
6
7 #include "base/logging.h"
8 #include "base/memory/singleton.h"
9 #include "crypto/openssl_util.h"
10 #include "net/android/network_library.h"
11 #include "third_party/boringssl/src/include/openssl/bytestring.h"
12 #include "third_party/boringssl/src/include/openssl/evp.h"
13 #include "third_party/boringssl/src/include/openssl/mem.h"
14
15 namespace net {
16
17 bool OpenSSLPrivateKeyStore::StoreKeyPair(const GURL& url, EVP_PKEY* pkey) {
18 // Always clear openssl errors on exit.
19 crypto::OpenSSLErrStackTracer err_trace(FROM_HERE);
20
21 uint8_t* public_key;
22 size_t public_len;
23 bssl::ScopedCBB cbb;
24 if (!CBB_init(cbb.get(), 0) || !EVP_marshal_public_key(cbb.get(), pkey) ||
25 !CBB_finish(cbb.get(), &public_key, &public_len)) {
26 return false;
27 }
28 bssl::UniquePtr<uint8_t> free_public_key(public_key);
29
30 uint8_t* private_key;
31 size_t private_len;
32 cbb.Reset();
33 if (!CBB_init(cbb.get(), 0) || !EVP_marshal_private_key(cbb.get(), pkey) ||
34 !CBB_finish(cbb.get(), &private_key, &private_len)) {
35 return false;
36 }
37 bssl::UniquePtr<uint8_t> free_private_key(private_key);
38
39 if (!android::StoreKeyPair(public_key, public_len, private_key,
40 private_len)) {
41 LOG(ERROR) << "StoreKeyPair failed. public_len = " << public_len
42 << " private_len = " << private_len;
43 }
44 return true;
45 }
46
47 } // namespace net
OLDNEW
« no previous file with comments | « net/base/openssl_private_key_store.h ('k') | net/base/openssl_private_key_store_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698