[Spice-devel] [PATCH libcacard 15/45] cac: Expose real key size in PKI Applet properties

Jakub Jelen jjelen at redhat.com
Tue Jul 31 14:50:09 UTC 2018


Signed-off-by: Jakub Jelen <jjelen at redhat.com>
Reviewed-by: Robert Relyea <rrelyea at redhat.com>
---
 src/cac.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/cac.c b/src/cac.c
index 4b54e91..c7b5006 100644
--- a/src/cac.c
+++ b/src/cac.c
@@ -627,6 +627,7 @@ cac_new_pki_applet_private(int i, const unsigned char *cert,
 {
     CACPKIAppletData *pki_applet_data;
     VCardAppletPrivate *applet_private;
+    int bits;
 
     /* PKI applet Properies ex.:
      * 01  Tag: Applet Information
@@ -743,8 +744,10 @@ cac_new_pki_applet_private(int i, const unsigned char *cert,
     pki_object[1].value.value = buffer_properties;
 
     /* PKI properties needs adjustments based on the key sizes */
-    // TODO XXX assuming 1024 b keys!
-    // pki_properties[1] = key_bits >> 3;
+    bits = vcard_emul_rsa_bits(key);
+    g_debug("RSA bits = %d", bits);
+    if (bits > 0)
+        pki_properties[1] = 0xff & (bits / 8 / 8);
     pki_object[2].value.value = pki_properties;
 
     /* Inject Applet Version */
-- 
2.17.1



More information about the Spice-devel mailing list