| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/socket/dns_cert_provenance_checker.h" | 5 #include "net/socket/dns_cert_provenance_checker.h" |
| 6 | 6 |
| 7 #if !defined(USE_OPENSSL) | 7 #if !defined(USE_OPENSSL) |
| 8 | 8 |
| 9 #include <nspr.h> | 9 #include <nspr.h> |
| 10 | 10 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 scoped_ptr<crypto::SymmetricKey> symkey( | 305 scoped_ptr<crypto::SymmetricKey> symkey( |
| 306 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, raw_key)); | 306 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, raw_key)); |
| 307 std::string iv(key_data + kKeySizeInBytes, kIVSizeInBytes); | 307 std::string iv(key_data + kKeySizeInBytes, kIVSizeInBytes); |
| 308 | 308 |
| 309 crypto::Encryptor encryptor; | 309 crypto::Encryptor encryptor; |
| 310 bool r = encryptor.Init(symkey.get(), crypto::Encryptor::CBC, iv); | 310 bool r = encryptor.Init(symkey.get(), crypto::Encryptor::CBC, iv); |
| 311 CHECK(r); | 311 CHECK(r); |
| 312 | 312 |
| 313 std::string plaintext(reinterpret_cast<const char*>(p.data()), p.size()); | 313 std::string plaintext(reinterpret_cast<const char*>(p.data()), p.size()); |
| 314 std::string ciphertext; | 314 std::string ciphertext; |
| 315 encryptor.Encrypt(plaintext, &ciphertext); | 315 r = encryptor.Encrypt(plaintext, &ciphertext); |
| 316 CHECK(r); |
| 316 | 317 |
| 317 // We use another Pickle object to serialise the 'outer' wrapping of the | 318 // We use another Pickle object to serialise the 'outer' wrapping of the |
| 318 // plaintext. | 319 // plaintext. |
| 319 Pickle outer; | 320 Pickle outer; |
| 320 outer.WriteInt(kVersion); | 321 outer.WriteInt(kVersion); |
| 321 | 322 |
| 322 SECItem* pub_key_serialized = SECKEY_EncodeDERSubjectPublicKeyInfo(pub_key); | 323 SECItem* pub_key_serialized = SECKEY_EncodeDERSubjectPublicKeyInfo(pub_key); |
| 323 outer.WriteString( | 324 outer.WriteString( |
| 324 std::string(reinterpret_cast<char*>(pub_key_serialized->data), | 325 std::string(reinterpret_cast<char*>(pub_key_serialized->data), |
| 325 pub_key_serialized->len)); | 326 pub_key_serialized->len)); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 355 | 356 |
| 356 std::string DnsCertProvenanceChecker::BuildEncryptedReport( | 357 std::string DnsCertProvenanceChecker::BuildEncryptedReport( |
| 357 const std::string& hostname, | 358 const std::string& hostname, |
| 358 const std::vector<std::string>& der_certs) { | 359 const std::vector<std::string>& der_certs) { |
| 359 return ""; | 360 return ""; |
| 360 } | 361 } |
| 361 | 362 |
| 362 } // namespace net | 363 } // namespace net |
| 363 | 364 |
| 364 #endif // USE_OPENSSL | 365 #endif // USE_OPENSSL |
| OLD | NEW |