From 86c57eec5084e4e7dd93934d7e644d2ef1480be5 Mon Sep 17 00:00:00 2001 From: Krzysztof Borgul Date: Mon, 1 Aug 2011 12:09:23 +0200 Subject: [PATCH] null PIN gives access to public objects in keystore --- .../java/src/org/opensc/pkcs11/spi/PKCS11KeyStoreSpi.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkcs11/java/src/org/opensc/pkcs11/spi/PKCS11KeyStoreSpi.java b/pkcs11/java/src/org/opensc/pkcs11/spi/PKCS11KeyStoreSpi.java index 397835f..4037fa1 100644 --- a/pkcs11/java/src/org/opensc/pkcs11/spi/PKCS11KeyStoreSpi.java +++ b/pkcs11/java/src/org/opensc/pkcs11/spi/PKCS11KeyStoreSpi.java @@ -463,6 +463,8 @@ public void engineStore(OutputStream arg0, char[] arg1) throws IOException, /* (non-Javadoc) * @see java.security.KeyStoreSpi#engineLoad(java.io.InputStream, char[]) + * + * If pin is null then keystore will contain only public objects */ @Override public void engineLoad(InputStream file, char[] pin) throws IOException, @@ -472,9 +474,9 @@ public void engineLoad(InputStream file, char[] pin) throws IOException, throw new IOException ("PKCS11 Key Store requires a null InputStream a the first argument."); PKCS11LoadStoreParameter param = new PKCS11LoadStoreParameter(); - - param.setProtectionParameter(new PasswordProtection(pin)); - + if (pin != null) { + param.setProtectionParameter(new PasswordProtection(pin)); + } engineLoad(param); }