| OLD | NEW |
| 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 <cert.h> | 7 #include <cert.h> |
| 8 #include <keyhi.h> | 8 #include <keyhi.h> |
| 9 #include <nss.h> | 9 #include <nss.h> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }; | 62 }; |
| 63 if (spki->algorithm.parameters.len == sizeof(kPrime256v1) && | 63 if (spki->algorithm.parameters.len == sizeof(kPrime256v1) && |
| 64 !memcmp(spki->algorithm.parameters.data, kPrime256v1, | 64 !memcmp(spki->algorithm.parameters.data, kPrime256v1, |
| 65 sizeof(kPrime256v1))) { | 65 sizeof(kPrime256v1))) { |
| 66 return ConvertEcPrime256v1PublicKeyInfoToJwk(spki, public_key_jwk); | 66 return ConvertEcPrime256v1PublicKeyInfoToJwk(spki, public_key_jwk); |
| 67 } | 67 } |
| 68 // TODO(juanlang): other curves | 68 // TODO(juanlang): other curves |
| 69 return false; | 69 return false; |
| 70 } | 70 } |
| 71 | 71 |
| 72 typedef scoped_ptr_malloc< | 72 typedef scoped_ptr< |
| 73 CERTSubjectPublicKeyInfo, | 73 CERTSubjectPublicKeyInfo, |
| 74 crypto::NSSDestroyer<CERTSubjectPublicKeyInfo, | 74 crypto::NSSDestroyer<CERTSubjectPublicKeyInfo, |
| 75 SECKEY_DestroySubjectPublicKeyInfo> > | 75 SECKEY_DestroySubjectPublicKeyInfo> > |
| 76 ScopedCERTSubjectPublicKeyInfo; | 76 ScopedCERTSubjectPublicKeyInfo; |
| 77 | 77 |
| 78 } // namespace | 78 } // namespace |
| 79 | 79 |
| 80 bool ConvertSpkiFromDerToJwk( | 80 bool ConvertSpkiFromDerToJwk( |
| 81 const base::StringPiece& spki_der, | 81 const base::StringPiece& spki_der, |
| 82 base::DictionaryValue* public_key_jwk) { | 82 base::DictionaryValue* public_key_jwk) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 109 sizeof(kIdEcPublicKey))) { | 109 sizeof(kIdEcPublicKey))) { |
| 110 rv = ConvertEcPublicKeyInfoToJwk(spki.get(), public_key_jwk); | 110 rv = ConvertEcPublicKeyInfoToJwk(spki.get(), public_key_jwk); |
| 111 } | 111 } |
| 112 // TODO(juanlang): other algorithms | 112 // TODO(juanlang): other algorithms |
| 113 return rv; | 113 return rv; |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace JwkSerializer | 116 } // namespace JwkSerializer |
| 117 | 117 |
| 118 } // namespace net | 118 } // namespace net |
| OLD | NEW |