X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Fosgi%2Fuseradmin%2FDigestUtils.java;h=55d24d994c7a3c681382def8e6efd93da1819682;hb=cceead8a279e8630f63cc9e8213bdcdca39955a5;hp=511c2fede5e747e8e7e3adef942a09063793c579;hpb=9f729eeb8255a9d800ad2506735dda8cc215a135;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/osgi/useradmin/DigestUtils.java b/org.argeo.util/src/org/argeo/osgi/useradmin/DigestUtils.java index 511c2fede..55d24d994 100644 --- a/org.argeo.util/src/org/argeo/osgi/useradmin/DigestUtils.java +++ b/org.argeo.util/src/org/argeo/osgi/useradmin/DigestUtils.java @@ -5,6 +5,8 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.spec.InvalidKeySpecException; import java.security.spec.KeySpec; import java.util.Arrays; @@ -22,8 +24,8 @@ class DigestUtils { digest.update(bytes); byte[] checksum = digest.digest(); return checksum; - } catch (Exception e) { - throw new UserDirectoryException("Cannot SHA1 digest", e); + } catch (NoSuchAlgorithmException e) { + throw new IllegalStateException("Cannot SHA1 digest", e); } } @@ -56,8 +58,8 @@ class DigestUtils { } else { throw new UnsupportedOperationException("Unkown password scheme " + passwordScheme); } - } catch (Exception e) { - throw new UserDirectoryException("Cannot digest", e); + } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { + throw new IllegalStateException("Cannot digest", e); } }