added jars, fixed tests

This commit is contained in:
Manfred Karrer 2015-11-03 15:34:04 +01:00
parent 3711519e3a
commit c5ee2c9186
36 changed files with 341 additions and 258 deletions

View file

@ -17,15 +17,10 @@
package io.bitsquare.common.crypto;
import io.bitsquare.app.Version;
import java.io.Serializable;
import java.security.PublicKey;
public final class DecryptedPayloadWithPubKey implements Serializable {
// That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
public final Serializable payload;
public final PublicKey sigPublicKey;

View file

@ -81,7 +81,6 @@ public class Encryption {
return cipher.doFinal(encryptedPayload);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException
| BadPaddingException | IllegalBlockSizeException | NoSuchProviderException e) {
e.printStackTrace();
throw new CryptoException(e);
}
}

View file

@ -34,7 +34,7 @@ import java.security.interfaces.DSAPrivateKey;
import java.security.interfaces.RSAPrivateCrtKey;
import java.security.spec.*;
// TODO: use a password protection for storage?
// TODO: use a password protection for key storage
public class KeyStorage {
private static final Logger log = LoggerFactory.getLogger(KeyStorage.class);
@ -140,6 +140,7 @@ public class KeyStorage {
if (!storageDir.exists())
storageDir.mkdir();
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(privateKey.getEncoded());
try (FileOutputStream fos = new FileOutputStream(storageDir + "/" + name + ".key")) {
fos.write(pkcs8EncodedKeySpec.getEncoded());