diff --git a/components/net/sf/briar/crypto/ErasableKeyImpl.java b/components/net/sf/briar/crypto/ErasableKeyImpl.java index b1b43ea0e22c564ed2b45fb399baffce88bcba04..34d29893c00b1b3a0e0c8f8bdb99fd469f88c50c 100644 --- a/components/net/sf/briar/crypto/ErasableKeyImpl.java +++ b/components/net/sf/briar/crypto/ErasableKeyImpl.java @@ -1,8 +1,5 @@ package net.sf.briar.crypto; -import java.util.ArrayList; -import java.util.Collection; - import net.sf.briar.api.crypto.ErasableKey; import net.sf.briar.util.ByteUtils; @@ -13,7 +10,6 @@ class ErasableKeyImpl implements ErasableKey { private final byte[] key; private final String algorithm; - private Collection<byte[]> copies = null; // Locking: this private boolean erased = false; // Locking: this ErasableKeyImpl(byte[] key, String algorithm) { @@ -27,11 +23,7 @@ class ErasableKeyImpl implements ErasableKey { public synchronized byte[] getEncoded() { if(erased) throw new IllegalStateException(); - byte[] b = new byte[key.length]; - System.arraycopy(key, 0, b, 0, key.length); - if(copies == null) copies = new ArrayList<byte[]>(); - copies.add(b); - return b; + return key; } public String getFormat() { @@ -45,7 +37,6 @@ class ErasableKeyImpl implements ErasableKey { public synchronized void erase() { if(erased) throw new IllegalStateException(); ByteUtils.erase(key); - if(copies != null) for(byte[] b : copies) ByteUtils.erase(b); erased = true; } }