List of usage examples for java.security NoSuchProviderException getMessage
public String getMessage()
From source file:test.be.fedict.eid.applet.SignatureServiceImpl.java
public DigestInfo preSign(List<DigestInfo> digestInfos, List<X509Certificate> signingCertificateChain) throws NoSuchAlgorithmException { LOG.debug("preSign"); HttpSession session = getHttpSession(); String toBeSigned = (String) session.getAttribute("toBeSigned"); LOG.debug("to be signed: " + toBeSigned); String digestAlgo = (String) session.getAttribute("digestAlgo"); LOG.debug("digest algo: " + digestAlgo); String javaDigestAlgo = digestAlgo; if (digestAlgo.endsWith("-PSS")) { LOG.debug("RSA/PSS detected"); javaDigestAlgo = digestAlgo.substring(0, digestAlgo.indexOf("-PSS")); LOG.debug("java digest algo: " + javaDigestAlgo); }/* w ww . j av a 2s. c om*/ MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance(javaDigestAlgo, BouncyCastleProvider.PROVIDER_NAME); } catch (NoSuchProviderException e) { throw new RuntimeException("bouncycastle error: " + e.getMessage(), e); } byte[] digestValue = messageDigest.digest(toBeSigned.getBytes()); String description = "Test Text Document"; return new DigestInfo(digestValue, digestAlgo, description); }