update
This commit is contained in:
@@ -4,6 +4,7 @@ Ex:
|
||||
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 api-prod.uspot.probesys.net /nebuleair?token=2AFF6dQk68daFZ
|
||||
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 webhook.site /13502b8b-201a-41ea-ae33-983516074de5
|
||||
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 aircarto.fr /tests/test.php
|
||||
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 ssl.aircarto.fr /test.php
|
||||
|
||||
|
||||
First profile id:
|
||||
@@ -99,7 +100,7 @@ ser_sara = serial.Serial(
|
||||
try:
|
||||
#step 1: import the certificate
|
||||
print("****")
|
||||
with open("/var/www/nebuleair_pro_4g/SARA/SSL/certificate/isrgrootx1.der", "rb") as cert_file:
|
||||
with open("/var/www/nebuleair_pro_4g/SARA/SSL/certificate/isrg-root-x2.der", "rb") as cert_file:
|
||||
certificate = cert_file.read()
|
||||
|
||||
size_of_string = len(certificate)
|
||||
@@ -107,7 +108,7 @@ try:
|
||||
print("\033[0;33m Import certificate\033[0m")
|
||||
# AT+USECMNG=0,<type>,<internal_name>,<data_size>
|
||||
# type-> 0 -> trusted root CA
|
||||
command = f'AT+USECMNG=0,0,"isrgrootx1",{size_of_string}\r'
|
||||
command = f'AT+USECMNG=0,0,"isrg-root-x2",{size_of_string}\r'
|
||||
ser_sara.write((command + '\r').encode('utf-8'))
|
||||
response_SARA_1 = read_complete_response(ser_sara)
|
||||
print(response_SARA_1)
|
||||
@@ -132,13 +133,14 @@ try:
|
||||
# *******************************
|
||||
# SECURITY PROFILE
|
||||
# AT+USECPRF=<profile_id>[,<op_code>[,<param_val>]]
|
||||
|
||||
security_profile_id = 0
|
||||
|
||||
|
||||
# op_code: 0 -> certificate validation level
|
||||
# param_val : 0 -> Level 0 No validation; 1-> Level 1 Root certificate validation
|
||||
security_profile_id = 0
|
||||
print("\033[0;33mSet the security profile (params)\033[0m")
|
||||
command = f'AT+USECPRF={security_profile_id},0,0\r'
|
||||
certification_level=0
|
||||
command = f'AT+USECPRF={security_profile_id},0,{certification_level}\r'
|
||||
ser_sara.write((command + '\r').encode('utf-8'))
|
||||
response_SARA_5b = read_complete_response(ser_sara, wait_for_line="OK")
|
||||
print(response_SARA_5b)
|
||||
@@ -147,7 +149,8 @@ try:
|
||||
# op_code: 1 -> minimum SSL/TLS version
|
||||
# param_val : 0 -> any; server can use any version for the connection; 1-> LSv1.0;
|
||||
print("\033[0;33mSet the security profile (params)\033[0m")
|
||||
command = f'AT+USECPRF={security_profile_id},1,0\r'
|
||||
minimum_SSL_version = 0
|
||||
command = f'AT+USECPRF={security_profile_id},1,{minimum_SSL_version}\r'
|
||||
ser_sara.write((command + '\r').encode('utf-8'))
|
||||
response_SARA_5bb = read_complete_response(ser_sara, wait_for_line="OK")
|
||||
print(response_SARA_5bb)
|
||||
@@ -155,7 +158,8 @@ try:
|
||||
|
||||
#op_code: 2 -> cipher suite
|
||||
print("\033[0;33mSet cipher \033[0m")
|
||||
command = f'AT+USECPRF={security_profile_id},2,0\r'
|
||||
cipher_suite = 1
|
||||
command = f'AT+USECPRF={security_profile_id},2,{cipher_suite}\r'
|
||||
ser_sara.write((command + '\r').encode('utf-8'))
|
||||
response_SARA_5cc = read_complete_response(ser_sara, wait_for_line="OK")
|
||||
print(response_SARA_5cc)
|
||||
@@ -163,7 +167,7 @@ try:
|
||||
|
||||
# op_code: 3 -> trusted root certificate internal name
|
||||
print("\033[0;33mSet the security profile (choose cert)\033[0m")
|
||||
command = f'AT+USECPRF={security_profile_id},3,"isrgrootx1"\r'
|
||||
command = f'AT+USECPRF={security_profile_id},3,"isrg-root-x2"\r'
|
||||
ser_sara.write((command + '\r').encode('utf-8'))
|
||||
response_SARA_5c = read_complete_response(ser_sara, wait_for_line="OK")
|
||||
print(response_SARA_5c)
|
||||
@@ -193,8 +197,8 @@ try:
|
||||
#step 4: set url to SSL (op_code = 6) (http_secure = 1 for HTTPS)(USECMNG_PROFILE = 2)
|
||||
print("\033[0;33mSET SSL\033[0m")
|
||||
http_secure = 1
|
||||
#command = f'AT+UHTTP={profile_id},6,{http_secure},{security_profile_id}\r'
|
||||
command = f'AT+UHTTP={profile_id},6,{http_secure}\r'
|
||||
command = f'AT+UHTTP={profile_id},6,{http_secure},{security_profile_id}\r'
|
||||
#command = f'AT+UHTTP={profile_id},6,{http_secure}\r'
|
||||
|
||||
ser_sara.write(command.encode('utf-8'))
|
||||
response_SARA_5 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||
|
||||
Reference in New Issue
Block a user