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

Side by Side Diff: chrome/browser/extensions/api/networking_private/networking_private_crypto.h

Issue 22295002: Base infrastructure for Networking Private API on Windows and Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use crypto_verify_mock for browser_test. Created 7 years, 1 month 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CRYP TO_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CRYP TO_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CRYP TO_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CRYP TO_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
(...skipping 10 matching lines...) Expand all
21 // 1) The MAC address listed in the certificate matches |connected_mac|. 21 // 1) The MAC address listed in the certificate matches |connected_mac|.
22 // 2) The certificate is a valid PEM encoded certificate signed by trusted CA. 22 // 2) The certificate is a valid PEM encoded certificate signed by trusted CA.
23 // 3) |signature| is a valid signature for |data|, using the public key in 23 // 3) |signature| is a valid signature for |data|, using the public key in
24 // |certificate| 24 // |certificate|
25 bool VerifyCredentials(const std::string& certificate, 25 bool VerifyCredentials(const std::string& certificate,
26 const std::string& signature, 26 const std::string& signature,
27 const std::string& data, 27 const std::string& data,
28 const std::string& connected_mac); 28 const std::string& connected_mac);
29 29
30 // Encrypt |data| with |public_key|. |public_key| is a DER-encoded 30 // Encrypt |data| with |public_key|. |public_key| is a DER-encoded
31 // RSAPublicKey. |data| is some string of bytes at smaller than the 31 // RSAPublicKey. |data| is some string of bytes that is smaller than the
32 // maximum length permissable for encryption with a key of |public_key| size. 32 // maximum length permissible for PKCS#1 v1.5 with a key of |public_key| size.
33 // 33 //
34 // Returns true on success, storing the encrypted result in 34 // Returns true on success, storing the encrypted result in
35 // |encrypted_output|. 35 // |encrypted_output|.
36 bool EncryptByteString(const std::string& public_key, 36 bool EncryptByteString(const std::string& public_key,
37 const std::string& data, 37 const std::string& data,
38 std::string* encrypted_output); 38 std::string* encrypted_output);
39 39
40 private: 40 private:
41 friend class NetworkingPrivateCryptoTest; 41 friend class NetworkingPrivateCryptoTest;
42 42
43 // Decrypt |encrypted_data| with |private_key_pem|. |private_key_pem| is the 43 // Decrypt |encrypted_data| with |private_key_pem|. |private_key_pem| is the
44 // PKCS8 PEM-encoded private key. |encrypted_data| is data encrypted with 44 // PKCS8 PEM-encoded private key. |encrypted_data| is data encrypted with
45 // EncryptByteString. Used in NetworkingPrivateCryptoTest::EncryptString test. 45 // EncryptByteString. Used in NetworkingPrivateCryptoTest::EncryptString test.
46 // 46 //
47 // Returns true on success, storing the decrypted result in 47 // Returns true on success, storing the decrypted result in
48 // |decrypted_output|. 48 // |decrypted_output|.
49 bool DecryptByteString(const std::string& private_key_pem, 49 bool DecryptByteString(const std::string& private_key_pem,
50 const std::string& encrypted_data, 50 const std::string& encrypted_data,
51 std::string* decrypted_output); 51 std::string* decrypted_output);
52 52
53 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateCrypto); 53 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateCrypto);
54 }; 54 };
55 55
56 #endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_C RYPTO_H_ 56 #endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_C RYPTO_H_
57 57
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698