Java Code Examples for java.security.NoSuchProviderException#getMessage()
The following examples show how to use
java.security.NoSuchProviderException#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: X509Util.java From xipki with Apache License 2.0 | 5 votes |
private static CertificateFactory getCertFactory() throws CertificateException { synchronized (certFactLock) { if (certFact == null) { try { certFact = CertificateFactory.getInstance("X.509", "BC"); } catch (NoSuchProviderException ex) { throw new CertificateException("NoSuchProviderException: " + ex.getMessage()); } } return certFact; } }
Example 2
Source File: RepositoryManagedSignatureProvider.java From CounterSign with GNU Affero General Public License v3.0 | 5 votes |
@Override public boolean validateSignature(byte[] sig, byte[] hash) { String alg = config.getProperty(RepositoryManagedSignatureProviderFactory.SIGNATURE_ALGORITHM); String prov = config.getProperty(RepositoryManagedSignatureProviderFactory.JAVA_SIGNATURE_PROVIDER); boolean valid = false; try { Signature validate = Signature.getInstance(alg, prov); validate.initVerify(getPublicKey()); validate.update(hash); valid = validate.verify(sig); } catch(NoSuchProviderException nspe) { throw new AlfrescoRuntimeException("Provider: " + prov + " was not found: " + nspe.getMessage()); } catch (NoSuchAlgorithmException nsae) { throw new AlfrescoRuntimeException("Algorithm: " + alg + " is not available: " + nsae.getMessage()); } catch(SignatureException se) { valid = false; } catch(InvalidKeyException ike) { valid = false; } return valid; }
Example 3
Source File: RepositoryManagedSignatureProvider.java From CounterSign with GNU Affero General Public License v3.0 | 4 votes |
@Override public KeyStore getUserKeyStore(String storePassword) { try { NodeRef person = serviceRegistry.getPersonService().getPerson(user); if(person == null) { return null; } KeyStore keystore = KeyStore.getInstance("pkcs12"); // check to see if a keystore exists for this user NodeRef keystoreNode = counterSignService.getSignatureArtifact(person, CounterSignSignatureModel.ASSOC_SIGNERKEYSTORE); // if no keystore, create one, persist it and associate it with the user if(keystoreNode == null) { keystore = createUserKeyStore(person, storePassword); } else { // open the reader to the key and load it ContentReader keyReader = serviceRegistry.getContentService().getReader(keystoreNode, ContentModel.PROP_CONTENT); keystore.load(keyReader.getContentInputStream(), storePassword.toCharArray()); } // return the keystore return keystore; } catch(KeyStoreException kse) { throw new AlfrescoRuntimeException(kse.getMessage()); } catch (java.security.cert.CertificateException ce) { throw new AlfrescoRuntimeException(ce.getMessage()); } catch(NoSuchAlgorithmException nsaex) { throw new AlfrescoRuntimeException(nsaex.getMessage()); } catch (IOException ioex) { throw new AlfrescoRuntimeException(ioex.getMessage()); } catch (NoSuchProviderException nspex) { throw new AlfrescoRuntimeException(nspex.getMessage()); } }