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

Side by Side Diff: net/cert/jwk_serializer_openssl.cc

Issue 1223983002: Move WriteInto to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/cert/ct_objects_extractor_openssl.cc ('k') | net/cert/x509_cert_types_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/cert/jwk_serializer.h" 5 #include "net/cert/jwk_serializer.h"
6 6
7 #include <openssl/bn.h> 7 #include <openssl/bn.h>
8 #include <openssl/ec.h> 8 #include <openssl/ec.h>
9 #include <openssl/ec_key.h> 9 #include <openssl/ec_key.h>
10 #include <openssl/evp.h> 10 #include <openssl/evp.h>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 crypto::ScopedBIGNUM y(BN_new()); 55 crypto::ScopedBIGNUM y(BN_new());
56 if (!EC_POINT_get_affine_coordinates_GFp(ec_group, ec_point, 56 if (!EC_POINT_get_affine_coordinates_GFp(ec_group, ec_point,
57 x.get(), y.get(), NULL)) { 57 x.get(), y.get(), NULL)) {
58 return false; 58 return false;
59 } 59 }
60 60
61 // The coordinates are encoded with leading zeros included. 61 // The coordinates are encoded with leading zeros included.
62 std::string x_bytes; 62 std::string x_bytes;
63 std::string y_bytes; 63 std::string y_bytes;
64 if (!BN_bn2bin_padded(reinterpret_cast<uint8_t*>( 64 if (!BN_bn2bin_padded(reinterpret_cast<uint8_t*>(
65 WriteInto(&x_bytes, degree_bytes + 1)), degree_bytes, x.get()) || 65 base::WriteInto(&x_bytes, degree_bytes + 1)),
66 degree_bytes, x.get()) ||
66 !BN_bn2bin_padded(reinterpret_cast<uint8_t*>( 67 !BN_bn2bin_padded(reinterpret_cast<uint8_t*>(
67 WriteInto(&y_bytes, degree_bytes + 1)), degree_bytes, y.get())) { 68 base::WriteInto(&y_bytes, degree_bytes + 1)),
69 degree_bytes, y.get())) {
68 return false; 70 return false;
69 } 71 }
70 72
71 public_key_jwk->SetString("kty", "EC"); 73 public_key_jwk->SetString("kty", "EC");
72 public_key_jwk->SetString("crv", curve_name); 74 public_key_jwk->SetString("crv", curve_name);
73 75
74 std::string x_b64; 76 std::string x_b64;
75 base::Base64Encode(x_bytes, &x_b64); 77 base::Base64Encode(x_bytes, &x_b64);
76 public_key_jwk->SetString("x", x_b64); 78 public_key_jwk->SetString("x", x_b64);
77 79
(...skipping 24 matching lines...) Expand all
102 return ConvertEcKeyToJwk(pubkey.get(), public_key_jwk, err_tracer); 104 return ConvertEcKeyToJwk(pubkey.get(), public_key_jwk, err_tracer);
103 } else { 105 } else {
104 // TODO(juanlang): other algorithms 106 // TODO(juanlang): other algorithms
105 return false; 107 return false;
106 } 108 }
107 } 109 }
108 110
109 } // namespace JwkSerializer 111 } // namespace JwkSerializer
110 112
111 } // namespace net 113 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/ct_objects_extractor_openssl.cc ('k') | net/cert/x509_cert_types_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698