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

Side by Side Diff: third_party/tlslite/tlslite/messages.py

Issue 6804032: Add TLS-SRP (RFC 5054) support Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: remove "httpsv" scheme, minor NSS/OpenSSL changes Created 9 years, 8 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
« no previous file with comments | « third_party/tlslite/tlslite/errors.py ('k') | webkit/glue/password_form.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Classes representing TLS messages.""" 1 """Classes representing TLS messages."""
2 2
3 from utils.compat import * 3 from utils.compat import *
4 from utils.cryptomath import * 4 from utils.cryptomath import *
5 from errors import * 5 from errors import *
6 from utils.codec import * 6 from utils.codec import *
7 from constants import * 7 from constants import *
8 from X509 import X509 8 from X509 import X509
9 from X509CertChain import X509CertChain 9 from X509CertChain import X509CertChain
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 self.random = p.getFixBytes(32) 163 self.random = p.getFixBytes(32)
164 self.session_id = p.getVarBytes(1) 164 self.session_id = p.getVarBytes(1)
165 self.cipher_suites = p.getVarList(2, 2) 165 self.cipher_suites = p.getVarList(2, 2)
166 self.compression_methods = p.getVarList(1, 1) 166 self.compression_methods = p.getVarList(1, 1)
167 if not p.atLengthCheck(): 167 if not p.atLengthCheck():
168 totalExtLength = p.get(2) 168 totalExtLength = p.get(2)
169 soFar = 0 169 soFar = 0
170 while soFar != totalExtLength: 170 while soFar != totalExtLength:
171 extType = p.get(2) 171 extType = p.get(2)
172 extLength = p.get(2) 172 extLength = p.get(2)
173 if extType == 6: 173 if extType == ClientHelloExtension.srp:
174 self.srp_username = bytesToString(p.getVarBytes(1)) 174 self.srp_username = bytesToString(p.getVarBytes(1))
175 elif extType == 7: 175 elif extType == 7:
176 self.certificate_types = p.getVarList(1, 1) 176 self.certificate_types = p.getVarList(1, 1)
177 else: 177 else:
178 p.getFixBytes(extLength) 178 p.getFixBytes(extLength)
179 soFar += 4 + extLength 179 soFar += 4 + extLength
180 p.stopLengthCheck() 180 p.stopLengthCheck()
181 return self 181 return self
182 182
183 def write(self, trial=False): 183 def write(self, trial=False):
(...skipping 13 matching lines...) Expand all
197 extLength += 5 + len(self.srp_username) 197 extLength += 5 + len(self.srp_username)
198 if extLength > 0: 198 if extLength > 0:
199 w.add(extLength, 2) 199 w.add(extLength, 2)
200 200
201 if self.certificate_types and self.certificate_types != \ 201 if self.certificate_types and self.certificate_types != \
202 [CertificateType.x509]: 202 [CertificateType.x509]:
203 w.add(7, 2) 203 w.add(7, 2)
204 w.add(len(self.certificate_types)+1, 2) 204 w.add(len(self.certificate_types)+1, 2)
205 w.addVarSeq(self.certificate_types, 1, 1) 205 w.addVarSeq(self.certificate_types, 1, 1)
206 if self.srp_username: 206 if self.srp_username:
207 w.add(6, 2) 207 w.add(ClientHelloExtension.srp, 2)
208 w.add(len(self.srp_username)+1, 2) 208 w.add(len(self.srp_username)+1, 2)
209 w.addVarSeq(stringToBytes(self.srp_username), 1, 1) 209 w.addVarSeq(stringToBytes(self.srp_username), 1, 1)
210 210
211 return HandshakeMsg.postWrite(self, w, trial) 211 return HandshakeMsg.postWrite(self, w, trial)
212 212
213 213
214 class ServerHello(HandshakeMsg): 214 class ServerHello(HandshakeMsg):
215 def __init__(self): 215 def __init__(self):
216 self.contentType = ContentType.handshake 216 self.contentType = ContentType.handshake
217 self.server_version = (0,0) 217 self.server_version = (0,0)
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 def create(self, bytes): 575 def create(self, bytes):
576 self.bytes = bytes 576 self.bytes = bytes
577 return self 577 return self
578 578
579 def parse(self, p): 579 def parse(self, p):
580 self.bytes = p.bytes 580 self.bytes = p.bytes
581 return self 581 return self
582 582
583 def write(self): 583 def write(self):
584 return self.bytes 584 return self.bytes
OLDNEW
« no previous file with comments | « third_party/tlslite/tlslite/errors.py ('k') | webkit/glue/password_form.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698