tests: PEM encoded ca_cert blob
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
8ba809f67b
commit
2a0db3eb5d
1 changed files with 23 additions and 2 deletions
|
@ -2197,11 +2197,32 @@ def test_ap_wpa2_eap_tls_pkcs12(dev, apdev):
|
||||||
|
|
||||||
def test_ap_wpa2_eap_tls_pkcs12_blob(dev, apdev):
|
def test_ap_wpa2_eap_tls_pkcs12_blob(dev, apdev):
|
||||||
"""WPA2-Enterprise connection using EAP-TLS and PKCS#12 from configuration blob"""
|
"""WPA2-Enterprise connection using EAP-TLS and PKCS#12 from configuration blob"""
|
||||||
|
cert = read_pem("auth_serv/ca.pem")
|
||||||
|
cacert = binascii.hexlify(cert).decode()
|
||||||
|
run_ap_wpa2_eap_tls_pkcs12_blob(dev, apdev, cacert)
|
||||||
|
|
||||||
|
def test_ap_wpa2_eap_tls_pkcs12_blob_pem(dev, apdev):
|
||||||
|
"""WPA2-Enterprise connection using EAP-TLS and PKCS#12 from configuration blob and PEM ca_cert blob"""
|
||||||
|
with open("auth_serv/ca.pem", "r") as f:
|
||||||
|
lines = f.readlines()
|
||||||
|
copy = False
|
||||||
|
cert = ""
|
||||||
|
for l in lines:
|
||||||
|
if "-----BEGIN" in l:
|
||||||
|
copy = True
|
||||||
|
if copy:
|
||||||
|
cert += l
|
||||||
|
if "-----END" in l:
|
||||||
|
copy = False
|
||||||
|
break
|
||||||
|
cacert = binascii.hexlify(cert.encode()).decode()
|
||||||
|
run_ap_wpa2_eap_tls_pkcs12_blob(dev, apdev, cacert)
|
||||||
|
|
||||||
|
def run_ap_wpa2_eap_tls_pkcs12_blob(dev, apdev, cacert):
|
||||||
check_pkcs12_support(dev[0])
|
check_pkcs12_support(dev[0])
|
||||||
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
|
params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")
|
||||||
hapd = hostapd.add_ap(apdev[0], params)
|
hapd = hostapd.add_ap(apdev[0], params)
|
||||||
cert = read_pem("auth_serv/ca.pem")
|
if "OK" not in dev[0].request("SET blob cacert " + cacert):
|
||||||
if "OK" not in dev[0].request("SET blob cacert " + binascii.hexlify(cert).decode()):
|
|
||||||
raise Exception("Could not set cacert blob")
|
raise Exception("Could not set cacert blob")
|
||||||
with open("auth_serv/user.pkcs12", "rb") as f:
|
with open("auth_serv/user.pkcs12", "rb") as f:
|
||||||
if "OK" not in dev[0].request("SET blob pkcs12 " + binascii.hexlify(f.read()).decode()):
|
if "OK" not in dev[0].request("SET blob pkcs12 " + binascii.hexlify(f.read()).decode()):
|
||||||
|
|
Loading…
Reference in a new issue