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

Unified Diff: third_party/tlslite/tlslite/messages.py

Issue 3177015: Improve support for requesting client certs in tlslite (Closed)
Patch Set: Cert requests got turned on across the board Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tlslite/tlslite/X509.py ('k') | third_party/tlslite/tlslite/utils/ASN1Parser.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tlslite/tlslite/messages.py
diff --git a/third_party/tlslite/tlslite/messages.py b/third_party/tlslite/tlslite/messages.py
index 06c46b9cadbf924cb0110520ba07d61065b41c8d..fb4cc2173bd50443de9d9d18dbc5b43feb9c3271 100644
--- a/third_party/tlslite/tlslite/messages.py
+++ b/third_party/tlslite/tlslite/messages.py
@@ -347,8 +347,7 @@ class CertificateRequest(HandshakeMsg):
def __init__(self):
self.contentType = ContentType.handshake
self.certificate_types = []
- #treat as opaque bytes for now
- self.certificate_authorities = createByteArraySequence([])
+ self.certificate_authorities = []
def create(self, certificate_types, certificate_authorities):
self.certificate_types = certificate_types
@@ -358,7 +357,13 @@ class CertificateRequest(HandshakeMsg):
def parse(self, p):
p.startLengthCheck(3)
self.certificate_types = p.getVarList(1, 1)
- self.certificate_authorities = p.getVarBytes(2)
+ ca_list_length = p.get(2)
+ index = 0
+ self.certificate_authorities = []
+ while index != ca_list_length:
+ ca_bytes = p.getVarBytes(2)
+ self.certificate_authorities.append(ca_bytes)
+ index += len(ca_bytes)+2
p.stopLengthCheck()
return self
@@ -366,7 +371,14 @@ class CertificateRequest(HandshakeMsg):
w = HandshakeMsg.preWrite(self, HandshakeType.certificate_request,
trial)
w.addVarSeq(self.certificate_types, 1, 1)
- w.addVarSeq(self.certificate_authorities, 1, 2)
+ caLength = 0
+ #determine length
+ for ca_dn in self.certificate_authorities:
+ caLength += len(ca_dn)+2
+ w.add(caLength, 2)
+ #add bytes
+ for ca_dn in self.certificate_authorities:
+ w.addVarSeq(ca_dn, 1, 2)
return HandshakeMsg.postWrite(self, w, trial)
class ServerKeyExchange(HandshakeMsg):
« no previous file with comments | « third_party/tlslite/tlslite/X509.py ('k') | third_party/tlslite/tlslite/utils/ASN1Parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698