X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Futil%2Fsecurity%2FAbstractKeyring.java;h=68ae1a20e8d32590b3289dd60e7f0aa97e9c685e;hb=3a0d866fbeea3f78c293212f4b4fbaeba7dfe2bd;hp=28763f82b29c1009cdb97e21451cc2f9a5c0acea;hpb=0a7d938324d33848ac7dc4ef4007c73a714171ee;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/util/security/AbstractKeyring.java b/org.argeo.util/src/org/argeo/util/security/AbstractKeyring.java index 28763f82b..68ae1a20e 100644 --- a/org.argeo.util/src/org/argeo/util/security/AbstractKeyring.java +++ b/org.argeo.util/src/org/argeo/util/security/AbstractKeyring.java @@ -41,8 +41,8 @@ import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; -import org.argeo.ArgeoException; -import org.argeo.StreamUtils; +import org.argeo.util.internal.UtilsException; +import org.argeo.util.internal.StreamUtils; /** username / password based keyring. TODO internationalize */ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { @@ -95,13 +95,13 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { .iterator(); return iterator.next(); } catch (LoginException e) { - throw new ArgeoException("Keyring login failed", e); + throw new UtilsException("Keyring login failed", e); } } else { SecretKey secretKey = iterator.next(); if (iterator.hasNext()) - throw new ArgeoException( + throw new UtilsException( "More than one secret key in private credentials"); return secretKey; } @@ -125,7 +125,7 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { StreamUtils.copy(reader, writer); return writer.toCharArray(); } catch (IOException e) { - throw new ArgeoException("Cannot decrypt to char array", e); + throw new UtilsException("Cannot decrypt to char array", e); } finally { StreamUtils.closeQuietly(reader); StreamUtils.closeQuietly(in); @@ -144,7 +144,7 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { in = new ByteArrayInputStream(out.toByteArray()); set(path, in); } catch (IOException e) { - throw new ArgeoException("Cannot encrypt to char array", e); + throw new UtilsException("Cannot encrypt to char array", e); } finally { StreamUtils.closeQuietly(writer); StreamUtils.closeQuietly(out); @@ -191,7 +191,7 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { } return btPass; } catch (Exception e) { - throw new ArgeoException("Cannot hash", e); + throw new UtilsException("Cannot hash", e); } finally { StreamUtils.closeQuietly(out); StreamUtils.closeQuietly(writer); @@ -211,7 +211,7 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { char[] password = passwordCb.getPassword(); return password; } catch (Exception e) { - throw new ArgeoException("Cannot ask for a password", e); + throw new UtilsException("Cannot ask for a password", e); } }