/** * The user is responsible for closing any readers given in the parameter. */ @Override public synchronized void engineLoad(LoadStoreParameter parameter) throws IOException { if (storeRole != null) throw new IllegalStateException("Already initialized."); if (parameter instanceof KeyStoreLoadParameter) { storeRole = new KeyStoreRole(); loadKeyStore((KeyStoreLoadParameter) parameter); } else if (parameter instanceof TrustStoreLoadParameter) { storeRole = new TrustStoreRole(); loadTrustStore((TrustStoreLoadParameter) parameter); } else { throw new IllegalArgumentException("Expected key store or trust store load parameter, got " + parameter.getClass()); } }
@Override public void engineLoad(LoadStoreParameter param) throws IOException, NoSuchAlgorithmException, CertificateException { if (param == null) { engineLoad(null, null); return; } ProtectionParameter pParam = param.getProtectionParameter(); if (pParam == null) { throw new NoSuchAlgorithmException(); } if (pParam instanceof PasswordProtection) { char[] password = ((PasswordProtection) pParam).getPassword(); if (password == null) { throw new NoSuchAlgorithmException(); } else { return; } } throw new CertificateException(); }
@Override public void engineStore(LoadStoreParameter param) throws IOException, NoSuchAlgorithmException, CertificateException { if (param == null) { throw new IOException(); } ProtectionParameter pParam = param.getProtectionParameter(); if (pParam instanceof PasswordProtection) { char[] password = ((PasswordProtection) pParam).getPassword(); if (password == null) { throw new NoSuchAlgorithmException(); } else if (password.length == 0) { throw new CertificateException(); } return; } throw new UnsupportedOperationException(); }
@Override public void engineLoad(final LoadStoreParameter param) throws IOException, NoSuchAlgorithmException, CertificateException { LOGGER.debug("engineLoad"); /* * Allows for a KeyStore to be re-loaded * several times. */ this.beIDCard = null; this.authnCertificateChain = null; this.signCertificateChain = null; this.rrnCertificateChain = null; this.authnCertificate = null; this.signCertificate = null; this.citizenCaCertificate = null; this.rootCaCertificate = null; this.rrnCertificate = null; if (null == param) { return; } if (param instanceof BeIDKeyStoreParameter) { this.keyStoreParameter = (BeIDKeyStoreParameter) param; return; } if (param instanceof JFrame) { this.keyStoreParameter = new BeIDKeyStoreParameter(); JFrame frame = (JFrame) param; this.keyStoreParameter.setParentComponent(frame); return; } throw new NoSuchAlgorithmException(); }
public void engineStore(LoadStoreParameter param) throws IOException, NoSuchAlgorithmException, CertificateException { if (param == null) { throw new IllegalArgumentException("'param' arg cannot be null"); } if (!(param instanceof PKCS12StoreParameter || param instanceof JDKPKCS12StoreParameter)) { throw new IllegalArgumentException( "No support for 'param' of type " + param.getClass().getName()); } PKCS12StoreParameter bcParam; if (param instanceof PKCS12StoreParameter) { bcParam = (PKCS12StoreParameter)param; } else { bcParam = new PKCS12StoreParameter(((JDKPKCS12StoreParameter)param).getOutputStream(), param.getProtectionParameter(), ((JDKPKCS12StoreParameter)param).isUseDEREncoding()); } char[] password; ProtectionParameter protParam = param.getProtectionParameter(); if (protParam == null) { password = null; } else if (protParam instanceof KeyStore.PasswordProtection) { password = ((KeyStore.PasswordProtection)protParam).getPassword(); } else { throw new IllegalArgumentException( "No support for protection parameter of type " + protParam.getClass().getName()); } doStore(bcParam.getOutputStream(), password, bcParam.isForDEREncoding()); }
@Override public void engineStore(LoadStoreParameter param) throws IOException, NoSuchAlgorithmException, CertificateException { LOGGER.debug("engineStore"); super.engineStore(param); }
public LoadStoreParameter getLoadStoreParameter() { return this.loadStoreParameter; }
public void setLoadStoreParameter(LoadStoreParameter loadStoreParameter) { this.loadStoreParameter = loadStoreParameter; }
/** * @param loadStoreParameter An optional {@link LoadStoreParameter} setting for * opening a PKCS11 session in contexts, which require opening * a new session is required. */ void setLoadStoreParameter(LoadStoreParameter loadStoreParameter);
/** * @return The optional LoadStoreParameter settings. */ LoadStoreParameter getLoadStoreParameter();