From aa4d2e02a58a99cf4e880e43d08fcf4fd28a7ff0 Mon Sep 17 00:00:00 2001 From: Roberto Cirillo Date: Thu, 3 Oct 2013 08:19:28 +0000 Subject: [PATCH] updated to version 1.0.1 snapshot added log in loading simmetric key git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/Common/common-encryption@82339 82a268e6-3cf1-43bd-a215-b396298e98cf --- pom.xml | 2 +- .../java/org/gcube/common/encryption/SymmetricKey.java | 8 +++++--- src/test/resources/devsec.gcubekey | 2 +- src/test/resources/devsec.gcubekeyLocale | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 src/test/resources/devsec.gcubekeyLocale diff --git a/pom.xml b/pom.xml index 1c14261..41bfbd1 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.gcube.core common-encryption - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT EncryptionLibrary A collection of Encryption utilities diff --git a/src/main/java/org/gcube/common/encryption/SymmetricKey.java b/src/main/java/org/gcube/common/encryption/SymmetricKey.java index 4ff89b8..297e143 100644 --- a/src/main/java/org/gcube/common/encryption/SymmetricKey.java +++ b/src/main/java/org/gcube/common/encryption/SymmetricKey.java @@ -41,13 +41,15 @@ final class SymmetricKey { */ private static void load() throws InvalidKeyException { byte[] rawKey; + String keyFileName=null; try { - InputStream is =SymmetricKey.class.getResourceAsStream("/"+getKeyFileName()); + keyFileName=getKeyFileName(); + InputStream is =SymmetricKey.class.getResourceAsStream("/"+keyFileName); rawKey = getBytesFromStream(is); } catch (Exception e) { - System.out.println("Unable to load the Key from the classpath"); + System.out.println("Unable to load the Key "+keyFileName+" from the classpath"); e.printStackTrace(); - throw new InvalidKeyException(); + throw new InvalidKeyException("Unable to load the Key "+keyFileName+" from the classpath"); } try { key = new SecretKeySpec(rawKey, 0, rawKey.length, keyAlgorithm); diff --git a/src/test/resources/devsec.gcubekey b/src/test/resources/devsec.gcubekey index cd412c6..b113201 100644 --- a/src/test/resources/devsec.gcubekey +++ b/src/test/resources/devsec.gcubekey @@ -1 +1 @@ - &Ù|€lÅ5²t`ÿûŠjw \ No newline at end of file +< ¬@Qaj¤F€g¸ðQ \ No newline at end of file diff --git a/src/test/resources/devsec.gcubekeyLocale b/src/test/resources/devsec.gcubekeyLocale new file mode 100644 index 0000000..cd412c6 --- /dev/null +++ b/src/test/resources/devsec.gcubekeyLocale @@ -0,0 +1 @@ + &Ù|€lÅ5²t`ÿûŠjw \ No newline at end of file