| OLD | NEW |
| 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- | 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 * | 2 * |
| 3 * ***** BEGIN LICENSE BLOCK ***** | 3 * ***** BEGIN LICENSE BLOCK ***** |
| 4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 5 * | 5 * |
| 6 * The contents of this file are subject to the Mozilla Public License Version | 6 * The contents of this file are subject to the Mozilla Public License Version |
| 7 * 1.1 (the "License"); you may not use this file except in compliance with | 7 * 1.1 (the "License"); you may not use this file except in compliance with |
| 8 * the License. You may obtain a copy of the License at | 8 * the License. You may obtain a copy of the License at |
| 9 * http://www.mozilla.org/MPL/ | 9 * http://www.mozilla.org/MPL/ |
| 10 * | 10 * |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 // Sign the DER encoded PublicKeyAndChallenge. | 208 // Sign the DER encoded PublicKeyAndChallenge. |
| 209 sec_rv = SEC_DerSignData(arena, &signedItem, pkacItem.data, pkacItem.len, | 209 sec_rv = SEC_DerSignData(arena, &signedItem, pkacItem.data, pkacItem.len, |
| 210 privateKey, algTag); | 210 privateKey, algTag); |
| 211 if (SECSuccess != sec_rv) { | 211 if (SECSuccess != sec_rv) { |
| 212 LOG(ERROR) << "Couldn't sign the DER encoded PublicKeyandChallenge"; | 212 LOG(ERROR) << "Couldn't sign the DER encoded PublicKeyandChallenge"; |
| 213 isSuccess = false; | 213 isSuccess = false; |
| 214 goto failure; | 214 goto failure; |
| 215 } | 215 } |
| 216 | 216 |
| 217 // Convert the signed public key and challenge into base64/ascii. | 217 // Convert the signed public key and challenge into base64/ascii. |
| 218 if (!base::Base64Encode(std::string(reinterpret_cast<char*>(signedItem.data), | 218 base::Base64Encode( |
| 219 signedItem.len), | 219 std::string(reinterpret_cast<char*>(signedItem.data), signedItem.len), |
| 220 &result_blob)) { | 220 &result_blob); |
| 221 LOG(ERROR) << "Couldn't convert signed public key into base64"; | |
| 222 isSuccess = false; | |
| 223 goto failure; | |
| 224 } | |
| 225 | 221 |
| 226 failure: | 222 failure: |
| 227 if (!isSuccess) { | 223 if (!isSuccess) { |
| 228 LOG(ERROR) << "SSL Keygen failed! (NSS error code " << PR_GetError() << ")"; | 224 LOG(ERROR) << "SSL Keygen failed! (NSS error code " << PR_GetError() << ")"; |
| 229 } else { | 225 } else { |
| 230 VLOG(1) << "SSL Keygen succeeded!"; | 226 VLOG(1) << "SSL Keygen succeeded!"; |
| 231 } | 227 } |
| 232 | 228 |
| 233 // Do cleanups | 229 // Do cleanups |
| 234 if (privateKey) { | 230 if (privateKey) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 252 SECKEY_DestroySubjectPublicKeyInfo(spkInfo); | 248 SECKEY_DestroySubjectPublicKeyInfo(spkInfo); |
| 253 } | 249 } |
| 254 if (arena) { | 250 if (arena) { |
| 255 PORT_FreeArena(arena, PR_TRUE); | 251 PORT_FreeArena(arena, PR_TRUE); |
| 256 } | 252 } |
| 257 | 253 |
| 258 return (isSuccess ? result_blob : std::string()); | 254 return (isSuccess ? result_blob : std::string()); |
| 259 } | 255 } |
| 260 | 256 |
| 261 } // namespace mozilla_security_manager | 257 } // namespace mozilla_security_manager |
| OLD | NEW |