[Cryptech-Commits] [sw/pkcs11] 02/04: py11 support for C_CreateObject().

git at cryptech.is git at cryptech.is
Wed Sep 16 05:01:10 UTC 2015


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch ecdsa
in repository sw/pkcs11.

commit 4efbecd181140499b3bffac76cc35539d4ab37e0
Author: Rob Austein <sra at hactrn.net>
Date:   Tue Sep 15 16:03:56 2015 -0400

    py11 support for C_CreateObject().
---
 pkcs11.c         | 2 --
 py11/__init__.py | 6 ++++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/pkcs11.c b/pkcs11.c
index 83d0ed4..cfd14da 100644
--- a/pkcs11.c
+++ b/pkcs11.c
@@ -1686,8 +1686,6 @@ static int psnprintf(void *buffer_, size_t size, const char *format, ...)
 
 /*
  * Template checking and key generation.
- *
- * The checking code needs refactoring to support C_CreateObject().
  */
 
 /*
diff --git a/py11/__init__.py b/py11/__init__.py
index 204c897..fa6e0f5 100644
--- a/py11/__init__.py
+++ b/py11/__init__.py
@@ -116,6 +116,12 @@ class PKCS11 (object):
   def C_Verify(self, session, data, signature):
     self.so.C_Verify(session, data, len(data), signature, len(signature))
 
+  def C_CreateObject(self, session, template):
+    template = self.adb.to_ctypes(template)
+    handle = CK_OBJECT_HANDLE()
+    self.so.C_CreateObject(session, template, len(template), byref(handle))
+    return handle.value
+
 __all__ = ["PKCS11"]
 __all__.extend(name for name in globals()
                if name.startswith("CK")



More information about the Commits mailing list