aboutsummaryrefslogtreecommitdiffstats
path: root/g10/seckey-cert.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/seckey-cert.c')
-rw-r--r--g10/seckey-cert.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c
index 76f0ee28d..5730735b8 100644
--- a/g10/seckey-cert.c
+++ b/g10/seckey-cert.c
@@ -225,6 +225,9 @@ check_secret_key( PKT_secret_key *sk, int n )
int rc = G10ERR_BAD_PASS;
int i,mode;
+ if (sk && sk->is_protected && sk->protect.s2k.mode == 1002)
+ return 0; /* Let the card support stuff handle this. */
+
if(n<0)
{
n=abs(n);
@@ -265,11 +268,14 @@ check_secret_key( PKT_secret_key *sk, int n )
/****************
* check whether the secret key is protected.
* Returns: 0 not protected, -1 on error or the protection algorithm
+ * -2 indicates a card stub.
*/
int
is_secret_key_protected( PKT_secret_key *sk )
{
- return sk->is_protected? sk->protect.algo : 0;
+ return sk->is_protected?
+ sk->protect.s2k.mode == 1002? -2
+ : sk->protect.algo : 0;
}