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

Side by Side Diff: runtime/bin/secure_socket.h

Issue 21716004: dart:io | Add SecureSocket.importPrivateCertificates, that reads a PKCS#12 file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add delayed deletion of locked temp directory on Windows. Created 7 years, 4 months 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef BIN_SECURE_SOCKET_H_ 5 #ifndef BIN_SECURE_SOCKET_H_
6 #define BIN_SECURE_SOCKET_H_ 6 #define BIN_SECURE_SOCKET_H_
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 28 matching lines...) Expand all
39 // These enums must agree with those in sdk/lib/io/secure_socket.dart. 39 // These enums must agree with those in sdk/lib/io/secure_socket.dart.
40 enum BufferIndex { 40 enum BufferIndex {
41 kReadPlaintext, 41 kReadPlaintext,
42 kWritePlaintext, 42 kWritePlaintext,
43 kReadEncrypted, 43 kReadEncrypted,
44 kWriteEncrypted, 44 kWriteEncrypted,
45 kNumBuffers, 45 kNumBuffers,
46 kFirstEncrypted = kReadEncrypted 46 kFirstEncrypted = kReadEncrypted
47 }; 47 };
48 48
49 static dart::Mutex* mutex; // To protect library initialization.
50
49 SSLFilter() 51 SSLFilter()
50 : callback_error(NULL), 52 : callback_error(NULL),
51 string_start_(NULL), 53 string_start_(NULL),
52 string_length_(NULL), 54 string_length_(NULL),
53 handshake_complete_(NULL), 55 handshake_complete_(NULL),
54 bad_certificate_callback_(NULL), 56 bad_certificate_callback_(NULL),
55 in_handshake_(false), 57 in_handshake_(false),
56 client_certificate_name_(NULL), 58 client_certificate_name_(NULL),
57 filter_(NULL) { } 59 filter_(NULL) { }
58 60
(...skipping 21 matching lines...) Expand all
80 int start2, int end2); 82 int start2, int end2);
81 intptr_t ProcessReadEncryptedBuffer(int start, int end); 83 intptr_t ProcessReadEncryptedBuffer(int start, int end);
82 intptr_t ProcessWriteEncryptedBuffer(int start, int end); 84 intptr_t ProcessWriteEncryptedBuffer(int start, int end);
83 bool ProcessAllBuffers(int starts[kNumBuffers], 85 bool ProcessAllBuffers(int starts[kNumBuffers],
84 int ends[kNumBuffers], 86 int ends[kNumBuffers],
85 bool in_handshake); 87 bool in_handshake);
86 Dart_Handle PeerCertificate(); 88 Dart_Handle PeerCertificate();
87 static void InitializeLibrary(const char* certificate_database, 89 static void InitializeLibrary(const char* certificate_database,
88 const char* password, 90 const char* password,
89 bool use_builtin_root_certificates, 91 bool use_builtin_root_certificates,
92 bool read_only,
90 bool report_duplicate_initialization = true); 93 bool report_duplicate_initialization = true);
91 static Dart_Port GetServicePort(); 94 static Dart_Port GetServicePort();
92 Dart_Handle callback_error; 95 Dart_Handle callback_error;
93 96
97 static char* GetPassword() { return password_; }
98
94 private: 99 private:
95 static const int kMemioBufferSize = 20 * KB; 100 static const int kMemioBufferSize = 20 * KB;
96 static bool library_initialized_; 101 static bool library_initialized_;
97 static const char* password_; 102 static char* password_;
98 static dart::Mutex* mutex_; // To protect library initialization.
99 static NativeService filter_service_; 103 static NativeService filter_service_;
100 104
101 uint8_t* buffers_[kNumBuffers]; 105 uint8_t* buffers_[kNumBuffers];
102 int buffer_size_; 106 int buffer_size_;
103 int encrypted_buffer_size_; 107 int encrypted_buffer_size_;
104 Dart_PersistentHandle string_start_; 108 Dart_PersistentHandle string_start_;
105 Dart_PersistentHandle string_length_; 109 Dart_PersistentHandle string_length_;
106 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers]; 110 Dart_PersistentHandle dart_buffer_objects_[kNumBuffers];
107 Dart_PersistentHandle handshake_complete_; 111 Dart_PersistentHandle handshake_complete_;
108 Dart_PersistentHandle bad_certificate_callback_; 112 Dart_PersistentHandle bad_certificate_callback_;
109 bool in_handshake_; 113 bool in_handshake_;
110 bool is_server_; 114 bool is_server_;
111 char* client_certificate_name_; 115 char* client_certificate_name_;
112 PRFileDesc* filter_; 116 PRFileDesc* filter_;
113 117
114 static bool isBufferEncrypted(int i) { 118 static bool isBufferEncrypted(int i) {
115 return static_cast<BufferIndex>(i) >= kFirstEncrypted; 119 return static_cast<BufferIndex>(i) >= kFirstEncrypted;
116 } 120 }
117 void InitializeBuffers(Dart_Handle dart_this); 121 void InitializeBuffers(Dart_Handle dart_this);
118 void InitializePlatformData();
119 122
120 DISALLOW_COPY_AND_ASSIGN(SSLFilter); 123 DISALLOW_COPY_AND_ASSIGN(SSLFilter);
121 }; 124 };
122 125
123 } // namespace bin 126 } // namespace bin
124 } // namespace dart 127 } // namespace dart
125 128
126 #endif // BIN_SECURE_SOCKET_H_ 129 #endif // BIN_SECURE_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698