Changeset: f829ae760bb6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f829ae760bb6
Modified Files:
        clients/mapilib/Tests/tlssecurity.py
        clients/mapilib/Tests/tlstester.py
        clients/mapilib/msettings.c
Branch: Dec2023
Log Message:

The certhash parameter changed from {sha256}digits to sha256:digits


diffs (68 lines):

diff --git a/clients/mapilib/Tests/tlssecurity.py 
b/clients/mapilib/Tests/tlssecurity.py
--- a/clients/mapilib/Tests/tlssecurity.py
+++ b/clients/mapilib/Tests/tlssecurity.py
@@ -196,7 +196,7 @@ attempt('connect_server_name', 'sni', No
 # of the server certificate in DER form. Have a succesful MAPI exchange.
 
 server1hash = sha256(certs.get_file('server1.der')).hexdigest()
-attempt('connect_right_hash', 'server1', None, certhash='{sha256}' + 
server1hash[:6])
+attempt('connect_right_hash', 'server1', None, certhash='sha256:' + 
server1hash[:6])
 
 # connect_wrong_hash
 #
@@ -208,7 +208,7 @@ first_digit = server1hash[0]
 other_digit = f"{8 ^ int(first_digit, 16):x}"
 wronghash = other_digit + server1hash[1:]
 
-attempt('connect_wrong_hash', 'server1', "does not match certhash", 
certhash='{sha256}' + wronghash[:6])
+attempt('connect_wrong_hash', 'server1', "does not match certhash", 
certhash='sha256:' + wronghash[:6])
 
 
 # connect_ca_hash
@@ -217,7 +217,7 @@ attempt('connect_wrong_hash', 'server1',
 # of the CA1 certificate in DER form. This should fail.
 
 ca1hash = sha256(certs.get_file('ca1.der')).hexdigest()
-attempt('connect_ca_hash', 'server1', "does not match certhash", 
certhash='{sha256}' + ca1hash[:6])
+attempt('connect_ca_hash', 'server1', "does not match certhash", 
certhash='sha256:' + ca1hash[:6])
 
 
 
diff --git a/clients/mapilib/Tests/tlstester.py 
b/clients/mapilib/Tests/tlstester.py
--- a/clients/mapilib/Tests/tlstester.py
+++ b/clients/mapilib/Tests/tlstester.py
@@ -555,7 +555,7 @@ class MapiHandler(socketserver.BaseReque
                     cert = 
self.tlstester.certs.get_file(f"{self.redirect}.der")
                     algo = 'sha256'
                     digest = hashlib.new(algo, cert).hexdigest()
-                    fingerprint = "{" + algo + "}" + digest
+                    fingerprint = algo + ":" + digest
                     msg = f"^monetdbs://{host}:{port}?certhash={fingerprint}\n"
                     self.send_message(bytes(msg, 'ascii'))
                     log.debug(
diff --git a/clients/mapilib/msettings.c b/clients/mapilib/msettings.c
--- a/clients/mapilib/msettings.c
+++ b/clients/mapilib/msettings.c
@@ -557,10 +557,10 @@ validate_certhash(msettings *mp)
        if (*certhash == '\0')
                return NULL;
 
-       if (strncmp(certhash, "{sha256}", 8) == 0) {
-               certhash += 8;
+       if (strncmp(certhash, "sha256:", 7) == 0) {
+               certhash += 7;
        } else {
-               return "expected certhash to start with '{sha256}'";
+               return "expected certhash to start with 'sha256:'";
        }
 
        size_t i = 0;
@@ -631,7 +631,7 @@ msettings_validate(msettings *mp, char *
                return false;
        }
 
-       // 5. If **certhash** is not empty, it must be of the form 
`{sha256}hexdigits`
+       // 5. If **certhash** is not empty, it must be of the form 
`sha256:hexdigits`
        //    where hexdigits is a non-empty sequence of 0-9, a-f, A-F and 
colons.
        const char *certhash_msg = validate_certhash(mp);
        if (certhash_msg) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to