| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_COMMON_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CRYPT
O_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CRYPT
O_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CRYPT
O_H_ | 6 #define CHROME_COMMON_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CRYPT
O_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 const std::string& connected_mac); | 28 const std::string& connected_mac); |
| 29 | 29 |
| 30 // The same as VerifyCredentials() above, but uses time |time| rather than the | 30 // The same as VerifyCredentials() above, but uses time |time| rather than the |
| 31 // current time for checking validity. | 31 // current time for checking validity. |
| 32 bool VerifyCredentialsAtTime( | 32 bool VerifyCredentialsAtTime( |
| 33 const std::string& certificate, | 33 const std::string& certificate, |
| 34 const std::vector<std::string>& intermediate_certificates, | 34 const std::vector<std::string>& intermediate_certificates, |
| 35 const std::string& signature, | 35 const std::string& signature, |
| 36 const std::string& data, | 36 const std::string& data, |
| 37 const std::string& connected_mac, | 37 const std::string& connected_mac, |
| 38 const base::Time::Exploded& time); | 38 const base::Time& time); |
| 39 | 39 |
| 40 // Encrypt |data| with |public_key|. |public_key| is a DER-encoded | 40 // Encrypt |data| with |public_key|. |public_key| is a DER-encoded |
| 41 // RSAPublicKey. |data| is some string of bytes that is smaller than the | 41 // RSAPublicKey. |data| is some string of bytes that is smaller than the |
| 42 // maximum length permissible for PKCS#1 v1.5 with a key of |public_key| size. | 42 // maximum length permissible for PKCS#1 v1.5 with a key of |public_key| size. |
| 43 // | 43 // |
| 44 // Returns true on success, storing the encrypted result in | 44 // Returns true on success, storing the encrypted result in |
| 45 // |encrypted_output|. | 45 // |encrypted_output|. |
| 46 bool EncryptByteString(const std::vector<uint8_t>& public_key, | 46 bool EncryptByteString(const std::vector<uint8_t>& public_key, |
| 47 const std::string& data, | 47 const std::string& data, |
| 48 std::vector<uint8_t>* encrypted_output); | 48 std::vector<uint8_t>* encrypted_output); |
| 49 | 49 |
| 50 // Decrypt |encrypted_data| with |private_key_pem|. |private_key_pem| is the | 50 // Decrypt |encrypted_data| with |private_key_pem|. |private_key_pem| is the |
| 51 // PKCS8 PEM-encoded private key. |encrypted_data| is data encrypted with | 51 // PKCS8 PEM-encoded private key. |encrypted_data| is data encrypted with |
| 52 // EncryptByteString. Used in NetworkingPrivateCryptoTest::EncryptString test. | 52 // EncryptByteString. Used in NetworkingPrivateCryptoTest::EncryptString test. |
| 53 // Returns true on success, storing the decrypted result in | 53 // Returns true on success, storing the decrypted result in |
| 54 // |decrypted_output|. | 54 // |decrypted_output|. |
| 55 bool DecryptByteString(const std::string& private_key_pem, | 55 bool DecryptByteString(const std::string& private_key_pem, |
| 56 const std::vector<uint8_t>& encrypted_data, | 56 const std::vector<uint8_t>& encrypted_data, |
| 57 std::string* decrypted_output); | 57 std::string* decrypted_output); |
| 58 | 58 |
| 59 } // namespace networking_private_crypto | 59 } // namespace networking_private_crypto |
| 60 | 60 |
| 61 #endif // CHROME_COMMON_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CR
YPTO_H_ | 61 #endif // CHROME_COMMON_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CR
YPTO_H_ |
| OLD | NEW |