@@ -79,6 +79,7 @@ def printUsage(s=None):
7979 [-c CERT] [-k KEY] [-t TACK] [-v VERIFIERDB] [-d DIR] [-l LABEL] [-L LENGTH]
8080 [--reqcert] [--param DHFILE] [--psk PSK] [--psk-ident IDENTITY]
8181 [--psk-sha384] [--ssl3] [--max-ver VER] [--tickets COUNT] [--cipherlist]
82+ [--request-pha]
8283 HOST:PORT
8384
8485 client
@@ -159,6 +160,7 @@ def handleArgs(argv, argString, flagsList=[]):
159160 max_ver = None
160161 tickets = None
161162 ciphers = []
163+ request_pha = False
162164
163165 for opt , arg in opts :
164166 if opt == "-k" :
@@ -232,6 +234,8 @@ def handleArgs(argv, argString, flagsList=[]):
232234 tickets = int (arg )
233235 elif opt == "--cipherlist" :
234236 ciphers .append (arg )
237+ elif opt == "--request-pha" :
238+ request_pha = True
235239 else :
236240 assert (False )
237241
@@ -294,6 +298,8 @@ def handleArgs(argv, argString, flagsList=[]):
294298 retList .append (tickets )
295299 if "cipherlist=" in flagsList :
296300 retList .append (ciphers )
301+ if "request-pha" in flagsList :
302+ retList .append (request_pha )
297303 return retList
298304
299305
@@ -494,11 +500,11 @@ def serverCmd(argv):
494500 (address , privateKey , cert_chain , virtual_hosts , tacks , verifierDB ,
495501 directory , reqCert ,
496502 expLabel , expLength , dhparam , psk , psk_ident , psk_hash , ssl3 ,
497- max_ver , tickets , cipherlist ) = \
503+ max_ver , tickets , cipherlist , request_pha ) = \
498504 handleArgs (argv , "kctbvdlL" ,
499505 ["reqcert" , "param=" , "psk=" ,
500506 "psk-ident=" , "psk-sha384" , "ssl3" , "max-ver=" ,
501- "tickets=" , "cipherlist=" ])
507+ "tickets=" , "cipherlist=" , "request-pha" ])
502508
503509
504510 if (cert_chain and not privateKey ) or (not cert_chain and privateKey ):
@@ -589,6 +595,13 @@ def handshake(self, connection):
589595 sni = sni )
590596 # As an example (does not work here):
591597 #nextProtos=[b"spdy/3", b"spdy/2", b"http/1.1"])
598+ try :
599+ if request_pha :
600+ for i in connection .request_post_handshake_auth ():
601+ pass
602+ except ValueError :
603+ # if we can't do PHA, we can't do it
604+ pass
592605 stop = time_stamp ()
593606 except TLSRemoteAlert as a :
594607 if a .description == AlertDescription .user_canceled :
0 commit comments