lists.arthurdejong.org
RSS feed

python-pskc branch master updated. 1.3-10-gb6b593c

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-pskc branch master updated. 1.3-10-gb6b593c



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-pskc".

The branch, master has been updated
       via  b6b593c18abb3cd5b36ea7fa8cbd848820749cc6 (commit)
       via  6cec25894bf5ebaef5b1ed34bfb4827a5329e09a (commit)
       via  4e19e9ce1f1972be93a45e598546e29105b398b7 (commit)
      from  df5f2c35564e0e5b74a652007cec0370bac553ff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-pskc/commit/?id=b6b593c18abb3cd5b36ea7fa8cbd848820749cc6

commit b6b593c18abb3cd5b36ea7fa8cbd848820749cc6
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Thu Dec 25 00:13:14 2025 +0100

    Fix the tests to set the serial on the device
    
    The serial is a property of the device, not the key.

diff --git a/tests/test_misc.doctest b/tests/test_misc.doctest
index 2607a3e..0c95a8d 100644
--- a/tests/test_misc.doctest
+++ b/tests/test_misc.doctest
@@ -64,10 +64,10 @@ True
 We can also put device-specific properties in a device:
 
 >>> pskc = PSKC()
->>> device = pskc.add_device(manufacturer='Tokens INC.')
+>>> device = pskc.add_device(manufacturer='Tokens INC.', serial='456')
 >>> len(pskc.keys)
 0
->>> key = device.add_key(id='123', serial='456')
+>>> key = device.add_key(id='123')
 >>> len(pskc.keys)
 1
 >>> key.id
diff --git a/tests/test_write.doctest b/tests/test_write.doctest
index 04d1c9e..5e9b0f9 100644
--- a/tests/test_write.doctest
+++ b/tests/test_write.doctest
@@ -1,6 +1,6 @@
 test_write.doctest - tests for writing PSKC files
 
-Copyright (C) 2014-2024 Arthur de Jong
+Copyright (C) 2014-2025 Arthur de Jong
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -625,8 +625,8 @@ is not allowed in the RFC 6030 schema. Note that device 
properties that are
 set on one key end up being applied to both keys.
 
 >>> pskc = PSKC()
->>> device = pskc.add_device(manufacturer='TokenVendorAcme')
->>> key = device.add_key(id='1', serial='123456', secret='1234', counter=42)
+>>> device = pskc.add_device(manufacturer='TokenVendorAcme', serial='123456')
+>>> key = device.add_key(id='1', secret='1234', counter=42)
 >>> key = device.add_key(id='pin0', secret='5678')
 >>> pskc.write(sys.stdout)  #doctest: +ELLIPSIS +REPORT_UDIFF
 <?xml version="1.0" encoding="UTF-8"?>

https://arthurdejong.org/git/python-pskc/commit/?id=6cec25894bf5ebaef5b1ed34bfb4827a5329e09a

commit 6cec25894bf5ebaef5b1ed34bfb4827a5329e09a
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Mon Dec 22 23:28:46 2025 +0100

    Allow emptying key list by asigning empty key name

diff --git a/pskc/encryption.py b/pskc/encryption.py
index 13e83ee..bdb3537 100644
--- a/pskc/encryption.py
+++ b/pskc/encryption.py
@@ -1,7 +1,7 @@
 # encryption.py - module for handling encrypted values
 # coding: utf-8
 #
-# Copyright (C) 2014-2024 Arthur de Jong
+# Copyright (C) 2014-2025 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -303,7 +303,10 @@ class Encryption(object):
 
     @key_name.setter
     def key_name(self, value):
-        self.key_names = [value]
+        if value:
+            self.key_names = [value]
+        else:
+            self.key_names = []
 
     @property
     def algorithm(self):
diff --git a/tests/test_misc.doctest b/tests/test_misc.doctest
index f135517..2607a3e 100644
--- a/tests/test_misc.doctest
+++ b/tests/test_misc.doctest
@@ -1,6 +1,6 @@
 test_misc.doctest - miscellaneous tests
 
-Copyright (C) 2014-2024 Arthur de Jong
+Copyright (C) 2014-2025 Arthur de Jong
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -123,6 +123,12 @@ Setting encryption key name and algorithm also works.
 >>> pskc.encryption.key_name = 'Test encryption key'
 >>> pskc.encryption.key_names
 ['Test encryption key']
+>>> pskc.encryption.key_names = ['Foo', 'Bar']
+>>> pskc.encryption.key_name
+'Foo'
+>>> pskc.encryption.key_name = None
+>>> pskc.encryption.key_names
+[]
 >>> pskc.encryption.algorithm is None
 True
 >>> pskc.encryption.algorithm = 'aes128-cbc'

https://arthurdejong.org/git/python-pskc/commit/?id=4e19e9ce1f1972be93a45e598546e29105b398b7

commit 4e19e9ce1f1972be93a45e598546e29105b398b7
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Mon Dec 22 17:25:04 2025 +0100

    Change PSKC.signature.certificate from bytes to str
    
    This better matches the types used by the signxml module.

diff --git a/pskc/parser.py b/pskc/parser.py
index f9c9567..5f82b78 100644
--- a/pskc/parser.py
+++ b/pskc/parser.py
@@ -1,7 +1,7 @@
 # parser.py - PSKC file parsing functions
 # coding: utf-8
 #
-# Copyright (C) 2016-2018 Arthur de Jong
+# Copyright (C) 2016-2025 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -387,9 +387,9 @@ class PSKCParser(object):
         certificate = findbin(
             signature_elm, 'KeyInfo/X509Data/X509Certificate')
         if certificate:
-            certificate = base64.b64encode(certificate)
-            signature.certificate = b'\n'.join(
-                [b'-----BEGIN CERTIFICATE-----'] +
+            certificate = base64.b64encode(certificate).decode('ascii')
+            signature.certificate = '\n'.join(
+                ['-----BEGIN CERTIFICATE-----'] +
                 [certificate[i:i + 64]
                  for i in range(0, len(certificate), 64)] +
-                [b'-----END CERTIFICATE-----'])
+                ['-----END CERTIFICATE-----'])
diff --git a/tests/test_signature.doctest b/tests/test_signature.doctest
index 94b6a00..1e3b06e 100644
--- a/tests/test_signature.doctest
+++ b/tests/test_signature.doctest
@@ -1,6 +1,6 @@
 test_signature.doctest - test XML signature checking functions
 
-Copyright (C) 2017 Arthur de Jong
+Copyright (C) 2017-2025 Arthur de Jong
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -75,7 +75,7 @@ argument).
 Read back the PSKC file and verify the signature.
 
 >>> newpskc = PSKC(f.name)
->>> print(tostr(newpskc.signature.certificate))  #doctest: +ELLIPSIS
+>>> print(newpskc.signature.certificate)  #doctest: +ELLIPSIS
 -----BEGIN CERTIFICATE-----
 ...
 -----END CERTIFICATE-----

-----------------------------------------------------------------------

Summary of changes:
 pskc/encryption.py           |  7 +++++--
 pskc/parser.py               | 10 +++++-----
 tests/test_misc.doctest      | 12 +++++++++---
 tests/test_signature.doctest |  4 ++--
 tests/test_write.doctest     |  6 +++---
 5 files changed, 24 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
python-pskc