Removed all incidents of e.printStackTrace, wrapped errors with
NoDashFatalExceptions instead of overwriting
This commit is contained in:
@@ -19,7 +19,7 @@ public abstract class NoConfigBase implements NoConfigInterface {
|
|||||||
keyGenerator.init(NoUtil.AES_STRENGTH);
|
keyGenerator.init(NoUtil.AES_STRENGTH);
|
||||||
this.secretKey = keyGenerator.generateKey();
|
this.secretKey = keyGenerator.generateKey();
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_KEY_SPEC not valid.");
|
throw new NoDashFatalException("Value for CIPHER_KEY_SPEC not valid.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public final class NoConfigDefault extends NoConfigBase implements Serializable
|
|||||||
|
|
||||||
Files.write(file.toPath(), data, StandardOpenOption.CREATE_NEW);
|
Files.write(file.toPath(), data, StandardOpenOption.CREATE_NEW);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new NoDashFatalException("Unable to save config, including generated secret key.");
|
throw new NoDashFatalException("Unable to save config, including generated secret key.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public final class NoConfigDefault extends NoConfigBase implements Serializable
|
|||||||
try {
|
try {
|
||||||
noConfig = (NoConfigDefault) ois.readObject();
|
noConfig = (NoConfigDefault) ois.readObject();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new NoDashFatalException("Given bytestream does not compile into a configuration object.");
|
throw new NoDashFatalException("Given bytestream does not compile into a configuration object.", e);
|
||||||
}
|
}
|
||||||
return noConfig;
|
return noConfig;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,14 +84,14 @@ public final class NoUtil {
|
|||||||
try {
|
try {
|
||||||
skf = SecretKeyFactory.getInstance(NoUtil.PBE_TYPE);
|
skf = SecretKeyFactory.getInstance(NoUtil.PBE_TYPE);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new NoDashFatalException("Value for PBE_TYPE is not valid.");
|
throw new NoDashFatalException("Value for PBE_TYPE is not valid.", e);
|
||||||
}
|
}
|
||||||
KeySpec spec = new PBEKeySpec(password, NoCore.config.getSecretKey().getEncoded(), 65536, 256);
|
KeySpec spec = new PBEKeySpec(password, NoCore.config.getSecretKey().getEncoded(), 65536, 256);
|
||||||
SecretKey key;
|
SecretKey key;
|
||||||
try {
|
try {
|
||||||
key = skf.generateSecret(spec);
|
key = skf.generateSecret(spec);
|
||||||
} catch (InvalidKeySpecException e) {
|
} catch (InvalidKeySpecException e) {
|
||||||
throw new NoDashFatalException("PBE manager unable to derive key from password.");
|
throw new NoDashFatalException("PBE manager unable to derive key from password.", e);
|
||||||
}
|
}
|
||||||
NoUtil.wipeChars(password);
|
NoUtil.wipeChars(password);
|
||||||
return key.getEncoded();
|
return key.getEncoded();
|
||||||
@@ -102,9 +102,8 @@ public final class NoUtil {
|
|||||||
MessageDigest messageDigest = MessageDigest.getInstance(NoUtil.DIGEST_TYPE);
|
MessageDigest messageDigest = MessageDigest.getInstance(NoUtil.DIGEST_TYPE);
|
||||||
return messageDigest.digest(bytes);
|
return messageDigest.digest(bytes);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
e.printStackTrace();
|
throw new NoDashFatalException("Value for DIGEST_TYPE not valid.", e);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] decryptByteArray(byte[] data, char[] password) throws IllegalBlockSizeException, BadPaddingException {
|
public static byte[] decryptByteArray(byte[] data, char[] password) throws IllegalBlockSizeException, BadPaddingException {
|
||||||
@@ -126,24 +125,23 @@ public final class NoUtil {
|
|||||||
try {
|
try {
|
||||||
cipher = Cipher.getInstance(NoUtil.CIPHER_TYPE);
|
cipher = Cipher.getInstance(NoUtil.CIPHER_TYPE);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_TYPE is not valid (no such algorithm).");
|
throw new NoDashFatalException("Value for CIPHER_TYPE is not valid (no such algorithm).", e);
|
||||||
} catch (NoSuchPaddingException e) {
|
} catch (NoSuchPaddingException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_TYPE is not valid (no such padding).");
|
throw new NoDashFatalException("Value for CIPHER_TYPE is not valid (no such padding).", e);
|
||||||
}
|
}
|
||||||
SecretKeySpec secretKey = new SecretKeySpec(key, NoUtil.CIPHER_KEY_SPEC);
|
SecretKeySpec secretKey = new SecretKeySpec(key, NoUtil.CIPHER_KEY_SPEC);
|
||||||
try {
|
try {
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
||||||
} catch (InvalidKeyException e) {
|
} catch (InvalidKeyException e) {
|
||||||
e.printStackTrace();
|
throw new NoDashFatalException("Secret key is invalid.", e);
|
||||||
throw new NoDashFatalException("Secret key is invalid.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return cipher.doFinal(data);
|
return cipher.doFinal(data);
|
||||||
} catch (IllegalBlockSizeException e) {
|
} catch (IllegalBlockSizeException e) {
|
||||||
throw new NoDashFatalException("Block size exception encountered during encryption.");
|
throw new NoDashFatalException("Block size exception encountered during encryption.", e);
|
||||||
} catch (BadPaddingException e) {
|
} catch (BadPaddingException e) {
|
||||||
throw new NoDashFatalException("Bad padding exception encountered during encryption.");
|
throw new NoDashFatalException("Bad padding exception encountered during encryption.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,16 +154,15 @@ public final class NoUtil {
|
|||||||
try {
|
try {
|
||||||
cipher = Cipher.getInstance(NoUtil.CIPHER_TYPE);
|
cipher = Cipher.getInstance(NoUtil.CIPHER_TYPE);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_TYPE is not valid (no such algorithm).");
|
throw new NoDashFatalException("Value for CIPHER_TYPE is not valid (no such algorithm).", e);
|
||||||
} catch (NoSuchPaddingException e) {
|
} catch (NoSuchPaddingException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_TYPE is not valid (no such padding).");
|
throw new NoDashFatalException("Value for CIPHER_TYPE is not valid (no such padding).", e);
|
||||||
}
|
}
|
||||||
SecretKeySpec secretKey = new SecretKeySpec(key, NoUtil.CIPHER_KEY_SPEC);
|
SecretKeySpec secretKey = new SecretKeySpec(key, NoUtil.CIPHER_KEY_SPEC);
|
||||||
try {
|
try {
|
||||||
cipher.init(Cipher.DECRYPT_MODE, secretKey);
|
cipher.init(Cipher.DECRYPT_MODE, secretKey);
|
||||||
} catch (InvalidKeyException e) {
|
} catch (InvalidKeyException e) {
|
||||||
e.printStackTrace();
|
throw new NoDashFatalException("Secret key is invalid.", e);
|
||||||
throw new NoDashFatalException("Secret key is invalid.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cipher.doFinal(data);
|
return cipher.doFinal(data);
|
||||||
@@ -180,19 +177,19 @@ public final class NoUtil {
|
|||||||
try {
|
try {
|
||||||
cipher = Cipher.getInstance(NoUtil.CIPHER_RSA_TYPE);
|
cipher = Cipher.getInstance(NoUtil.CIPHER_RSA_TYPE);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_RSA_TYPE is not valid (no such algorithm).");
|
throw new NoDashFatalException("Value for CIPHER_RSA_TYPE is not valid (no such algorithm).", e);
|
||||||
} catch (NoSuchPaddingException e) {
|
} catch (NoSuchPaddingException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_RSA_TYPE is not valid (no such padding).");
|
throw new NoDashFatalException("Value for CIPHER_RSA_TYPE is not valid (no such padding).", e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||||
return cipher.doFinal(data);
|
return cipher.doFinal(data);
|
||||||
} catch (InvalidKeyException e){
|
} catch (InvalidKeyException e){
|
||||||
throw new NoDashFatalException("Public key invalid.");
|
throw new NoDashFatalException("Public key invalid.", e);
|
||||||
} catch (IllegalBlockSizeException e) {
|
} catch (IllegalBlockSizeException e) {
|
||||||
throw new NoDashFatalException("Unable to encrypt data stream with public key.");
|
throw new NoDashFatalException("Unable to encrypt data stream with public key.", e);
|
||||||
} catch (BadPaddingException e) {
|
} catch (BadPaddingException e) {
|
||||||
throw new NoDashFatalException("Unable to encrypt data stream with public key.");
|
throw new NoDashFatalException("Unable to encrypt data stream with public key.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,9 +198,9 @@ public final class NoUtil {
|
|||||||
try {
|
try {
|
||||||
cipher = Cipher.getInstance(NoUtil.CIPHER_RSA_TYPE);
|
cipher = Cipher.getInstance(NoUtil.CIPHER_RSA_TYPE);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_RSA_TYPE is not valid (no such algorithm).");
|
throw new NoDashFatalException("Value for CIPHER_RSA_TYPE is not valid (no such algorithm).", e);
|
||||||
} catch (NoSuchPaddingException e) {
|
} catch (NoSuchPaddingException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_RSA_TYPE is not valid (no such padding).");
|
throw new NoDashFatalException("Value for CIPHER_RSA_TYPE is not valid (no such padding).", e);
|
||||||
}
|
}
|
||||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||||
return cipher.doFinal(data);
|
return cipher.doFinal(data);
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ public final class NoHashSphereDefault implements NoHashSphereInterface {
|
|||||||
ois.close();
|
ois.close();
|
||||||
bais.close();
|
bais.close();
|
||||||
} catch (IOException e){
|
} catch (IOException e){
|
||||||
throw new NoDashFatalException("Unable to load up given database file.");
|
throw new NoDashFatalException("Unable to load up given database file.", e);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new NoDashFatalException("Database file not in a verifiable format.");
|
throw new NoDashFatalException("Database file not in a verifiable format.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public final class NoSessionSphere {
|
|||||||
try {
|
try {
|
||||||
session.consume(nbs);
|
session.consume(nbs);
|
||||||
} catch (NoByteSetBadDecryptionException e) {
|
} catch (NoByteSetBadDecryptionException e) {
|
||||||
e.printStackTrace();
|
throw new NoDashFatalException("Bad byte sets on consumption.", e);
|
||||||
}
|
}
|
||||||
} /* 2.2 Alternatively, no NoByteSets to consume */
|
} /* 2.2 Alternatively, no NoByteSets to consume */
|
||||||
|
|
||||||
@@ -173,15 +173,15 @@ public final class NoSessionSphere {
|
|||||||
try {
|
try {
|
||||||
result.data = NoSessionSphere.save(result.cookie, password);
|
result.data = NoSessionSphere.save(result.cookie, password);
|
||||||
} catch (NoDashSessionBadUUIDException e) {
|
} catch (NoDashSessionBadUUIDException e) {
|
||||||
throw new NoDashFatalException("Immediately generated cookie throwing bad cookie error.");
|
throw new NoDashFatalException("Immediately generated cookie throwing bad cookie error.", e);
|
||||||
} catch (NoSessionExpiredException e) {
|
} catch (NoSessionExpiredException e) {
|
||||||
throw new NoDashFatalException("Session expired before it was even returned to client.");
|
throw new NoDashFatalException("Session expired before it was even returned to client.", e);
|
||||||
} catch (NoSessionConfirmedException e) {
|
} catch (NoSessionConfirmedException e) {
|
||||||
throw new NoDashFatalException("Session is in confirmed state before it was returned to client.");
|
throw new NoDashFatalException("Session is in confirmed state before it was returned to client.", e);
|
||||||
} catch (NoSessionNotChangedException e) {
|
} catch (NoSessionNotChangedException e) {
|
||||||
throw new NoDashFatalException("Session claims to be unchanged but user is newly registered.");
|
throw new NoDashFatalException("Session claims to be unchanged but user is newly registered.", e);
|
||||||
} catch (NoSessionAlreadyAwaitingConfirmationException e) {
|
} catch (NoSessionAlreadyAwaitingConfirmationException e) {
|
||||||
throw new NoDashFatalException("Session claims to be awaiting confirmation before returning data to the user.");
|
throw new NoDashFatalException("Session claims to be awaiting confirmation before returning data to the user.", e);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,8 @@ public class NoDashFatalException extends RuntimeException {
|
|||||||
public NoDashFatalException(String string) {
|
public NoDashFatalException(String string) {
|
||||||
super(string);
|
super(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NoDashFatalException(String string, Exception e) {
|
||||||
|
super(string, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public abstract class NoInfluence implements Serializable {
|
|||||||
try {
|
try {
|
||||||
keyGen = KeyGenerator.getInstance(NoUtil.CIPHER_KEY_SPEC);
|
keyGen = KeyGenerator.getInstance(NoUtil.CIPHER_KEY_SPEC);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
throw new NoDashFatalException("Value for CIPHER_KEY_SPEC is not valid.");
|
throw new NoDashFatalException("Value for CIPHER_KEY_SPEC is not valid.", e);
|
||||||
}
|
}
|
||||||
keyGen.init(NoUtil.AES_STRENGTH);
|
keyGen.init(NoUtil.AES_STRENGTH);
|
||||||
SecretKey secretKey = keyGen.generateKey();
|
SecretKey secretKey = keyGen.generateKey();
|
||||||
@@ -72,7 +72,7 @@ public abstract class NoInfluence implements Serializable {
|
|||||||
baos.close();
|
baos.close();
|
||||||
return encrypted;
|
return encrypted;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new NoDashFatalException("Unable to write NoInfluence object to byte stream.");
|
throw new NoDashFatalException("Unable to write NoInfluence object to byte stream.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public abstract class NoInfluence implements Serializable {
|
|||||||
bais.close();
|
bais.close();
|
||||||
return noInfluence;
|
return noInfluence;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new NoDashFatalException("Unable to read out provided data stream.");
|
throw new NoDashFatalException("Unable to read out provided data stream.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import java.util.UUID;
|
|||||||
import javax.crypto.BadPaddingException;
|
import javax.crypto.BadPaddingException;
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
|
|
||||||
|
import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
|
||||||
|
import com.sun.org.apache.xml.internal.security.utils.Base64;
|
||||||
|
|
||||||
import nodash.core.NoCore;
|
import nodash.core.NoCore;
|
||||||
import nodash.core.NoUtil;
|
import nodash.core.NoUtil;
|
||||||
import nodash.exceptions.NoByteSetBadDecryptionException;
|
import nodash.exceptions.NoByteSetBadDecryptionException;
|
||||||
@@ -109,7 +112,8 @@ public final class NoSession implements Serializable {
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void confirmSave(byte[] confirmData, char[] password) throws NoSessionConfirmedException, NoSessionExpiredException, NoSessionNotAwaitingConfirmationException, NoUserNotValidException {
|
public void confirmSave(byte[] confirmData, char[] password) throws NoSessionConfirmedException, NoSessionExpiredException,
|
||||||
|
NoSessionNotAwaitingConfirmationException, NoUserNotValidException {
|
||||||
this.check();
|
this.check();
|
||||||
if (this.state != NoState.AWAITING_CONFIRMATION) {
|
if (this.state != NoState.AWAITING_CONFIRMATION) {
|
||||||
throw new NoSessionNotAwaitingConfirmationException();
|
throw new NoSessionNotAwaitingConfirmationException();
|
||||||
@@ -138,15 +142,14 @@ public final class NoSession implements Serializable {
|
|||||||
try {
|
try {
|
||||||
NoCore.hashSphere.removeHash(this.original.createHashString());
|
NoCore.hashSphere.removeHash(this.original.createHashString());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new NoDashFatalException("Unable to remove hash on confirm.");
|
throw new NoDashFatalException("Unable to remove hash on confirm.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 5.2.2: add new hash to array */
|
/* 5.2.2: add new hash to array */
|
||||||
try {
|
try {
|
||||||
NoCore.hashSphere.insertHash(this.current.createHashString());
|
NoCore.hashSphere.insertHash(this.current.createHashString());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
throw new NoDashFatalException("Unable to remove hash on confirm.", e);
|
||||||
throw new NoDashFatalException("Unable to remove hash on confirm.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 5.2.3: clear influences as they will not need to be re-applied */
|
/* 5.2.3: clear influences as they will not need to be re-applied */
|
||||||
@@ -185,7 +188,11 @@ public final class NoSession implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getEncryptedUUID() {
|
public byte[] getEncryptedUUID() {
|
||||||
return NoUtil.encrypt(this.uuid.toString().getBytes());
|
try {
|
||||||
|
return NoUtil.encrypt(Base64.decode(this.uuid.toString()));
|
||||||
|
} catch (Base64DecodingException e) {
|
||||||
|
throw new NoDashFatalException("Base64DecodingException while decoding session UUID.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEncryptedUUIDAsString() {
|
public String getEncryptedUUIDAsString() {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import javax.crypto.spec.SecretKeySpec;
|
|||||||
import sun.security.rsa.RSAPublicKeyImpl;
|
import sun.security.rsa.RSAPublicKeyImpl;
|
||||||
import nodash.core.NoUtil;
|
import nodash.core.NoUtil;
|
||||||
import nodash.exceptions.NoByteSetBadDecryptionException;
|
import nodash.exceptions.NoByteSetBadDecryptionException;
|
||||||
|
import nodash.exceptions.NoDashFatalException;
|
||||||
|
|
||||||
public class NoUser implements Serializable {
|
public class NoUser implements Serializable {
|
||||||
private static final long serialVersionUID = 7132405837081692211L;
|
private static final long serialVersionUID = 7132405837081692211L;
|
||||||
@@ -57,19 +58,26 @@ public class NoUser implements Serializable {
|
|||||||
private ArrayList<NoAction> outgoing = new ArrayList<NoAction>();
|
private ArrayList<NoAction> outgoing = new ArrayList<NoAction>();
|
||||||
|
|
||||||
public NoUser() {
|
public NoUser() {
|
||||||
|
KeyPairGenerator kpg;
|
||||||
try {
|
try {
|
||||||
KeyPairGenerator kpg = KeyPairGenerator.getInstance(NoUtil.KEYPAIR_ALGORITHM);
|
kpg = KeyPairGenerator.getInstance(NoUtil.KEYPAIR_ALGORITHM);
|
||||||
kpg.initialize(NoUtil.RSA_STRENGTH, SecureRandom.getInstance(NoUtil.SECURERANDOM_ALGORITHM, NoUtil.SECURERANDOM_PROVIDER));
|
|
||||||
KeyPair keyPair = kpg.generateKeyPair();
|
|
||||||
this.publicKey = keyPair.getPublic();
|
|
||||||
this.privateKey = keyPair.getPrivate();
|
|
||||||
this.influences = 0;
|
|
||||||
this.actions = 0;
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
e.printStackTrace();
|
throw new NoDashFatalException("Value for KEYPAIR_ALGORITHM is not valid.", e);
|
||||||
} catch (NoSuchProviderException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
kpg.initialize(NoUtil.RSA_STRENGTH, SecureRandom.getInstance(NoUtil.SECURERANDOM_ALGORITHM, NoUtil.SECURERANDOM_PROVIDER));
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new NoDashFatalException("Value for SECURERANDOM_ALGORITHM not valid.", e);
|
||||||
|
} catch (NoSuchProviderException e) {
|
||||||
|
throw new NoDashFatalException("Value for SECURERANDOM_PROVIDER not valid.", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
KeyPair keyPair = kpg.generateKeyPair();
|
||||||
|
this.publicKey = keyPair.getPublic();
|
||||||
|
this.privateKey = keyPair.getPrivate();
|
||||||
|
this.influences = 0;
|
||||||
|
this.actions = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final byte[] createFile(char[] password) {
|
public final byte[] createFile(char[] password) {
|
||||||
@@ -84,11 +92,10 @@ public class NoUser implements Serializable {
|
|||||||
baos.close();
|
baos.close();
|
||||||
return encrypted;
|
return encrypted;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
throw new NoDashFatalException("IO Exception encountered while generating encrypted user file byte stream.", e);
|
||||||
} finally {
|
} finally {
|
||||||
this.outgoing = temp;
|
this.outgoing = temp;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final byte[] createHash() {
|
public final byte[] createHash() {
|
||||||
@@ -101,11 +108,10 @@ public class NoUser implements Serializable {
|
|||||||
byte[] userBytes = baos.toByteArray();
|
byte[] userBytes = baos.toByteArray();
|
||||||
return NoUtil.getHashFromByteArray(userBytes);
|
return NoUtil.getHashFromByteArray(userBytes);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
throw new NoDashFatalException("IO Exception encountered while generating user hash.", e);
|
||||||
} finally {
|
} finally {
|
||||||
this.outgoing = temp;
|
this.outgoing = temp;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String createHashString() {
|
public final String createHashString() {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public abstract class NoTargetedAction extends NoAction {
|
|||||||
}
|
}
|
||||||
} catch (NoCannotGetInfluenceException e) {
|
} catch (NoCannotGetInfluenceException e) {
|
||||||
if (e.getResponseInfluence() != null) {
|
if (e.getResponseInfluence() != null) {
|
||||||
throw new NoDashFatalException("Unsourced action has generated an error with an undeliverable influence.");
|
throw new NoDashFatalException("Unsourced action has generated an error with an undeliverable influence.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user