diff options
Diffstat (limited to 'src/rsa.c')
-rw-r--r-- | src/rsa.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -630,3 +630,36 @@ p11t_rsa_tests(void) p11t_slot_for_each_mech(CKM_RSA_PKCS, test_rsa); p11t_slot_for_each_mech(CKM_RSA_X_509, test_rsa); } + + +void +p11t_rsa_test_public_key(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE handle) +{ + CK_MECHANISM_TYPE_PTR mechanisms; + CK_ULONG n_mechanisms, i; + + mechanisms = p11t_key_get_mechanisms (session, handle, &n_mechanisms); + if (!mechanisms) + return; + + for (i = 0; i < n_mechanisms; ++i) + test_rsa_public_key (session, handle, mechanisms[i]); + + free (mechanisms); +} + +void +p11t_rsa_test_private_key(CK_SESSION_HANDLE session, CK_OBJECT_HANDLE handle) +{ + CK_MECHANISM_TYPE_PTR mechanisms; + CK_ULONG n_mechanisms, i; + + mechanisms = p11t_key_get_mechanisms (session, handle, &n_mechanisms); + if (!mechanisms) + return; + + for (i = 0; i < n_mechanisms; ++i) + test_rsa_private_key (session, handle, mechanisms[i]); + + free (mechanisms); +} |