name refactors
This commit is contained in:
@@ -28,7 +28,7 @@ import java.nio.file.StandardOpenOption;
|
||||
|
||||
import nodash.exceptions.NoDashFatalException;
|
||||
|
||||
public final class NoConfigDefault extends NoConfigBase implements Serializable {
|
||||
public final class NoConfigDefault extends NoConfigBase implements NoConfigInterface, Serializable {
|
||||
private static final long serialVersionUID = -8498303909736017075L;
|
||||
|
||||
private static final String CONFIG_FILENAME = "noconfig.cfg";
|
||||
|
||||
@@ -46,9 +46,9 @@ public final class NoByteSetSphere {
|
||||
}
|
||||
|
||||
public static List<NoByteSet> consume(NoUser user) {
|
||||
if (NoByteSetSphere.byteSets.containsKey(user.getRSAPublicKey())) {
|
||||
ArrayList<NoByteSet> result = NoByteSetSphere.byteSets.get(user.getRSAPublicKey());
|
||||
NoByteSetSphere.byteSets.remove(user.getRSAPublicKey());
|
||||
if (NoByteSetSphere.byteSets.containsKey(user.getRsaPublicKey())) {
|
||||
ArrayList<NoByteSet> result = NoByteSetSphere.byteSets.get(user.getRsaPublicKey());
|
||||
NoByteSetSphere.byteSets.remove(user.getRsaPublicKey());
|
||||
return result;
|
||||
} else {
|
||||
return NoByteSetSphere.EMPTY_BYTESET_LIST;
|
||||
|
||||
@@ -52,12 +52,12 @@ public final class NoSessionSphere {
|
||||
}
|
||||
}
|
||||
|
||||
public static void shred(byte[] encryptedUUID) {
|
||||
public static void shred(byte[] encryptedUuid) {
|
||||
try {
|
||||
UUID uuid = NoSession.decryptUuid(encryptedUUID);
|
||||
UUID uuid = NoSession.decryptUuid(encryptedUuid);
|
||||
if (NoSessionSphere.sessions.containsKey(uuid)) {
|
||||
NoSession session = NoSessionSphere.sessions.get(uuid);
|
||||
NoByteSetSphere.addList(session.incoming, session.current.getRSAPublicKey());
|
||||
NoByteSetSphere.addList(session.incoming, session.current.getRsaPublicKey());
|
||||
NoSessionSphere.originalHashesOnline.remove(Base64.encodeBase64String(session
|
||||
.getOriginalHash()));
|
||||
NoSessionSphere.sessions.remove(uuid);
|
||||
@@ -74,7 +74,7 @@ public final class NoSessionSphere {
|
||||
session.check();
|
||||
} catch (NoSessionExpiredException e) {
|
||||
/* Resultant from 3.1 and 3.2 */
|
||||
NoByteSetSphere.addList(session.incoming, session.current.getRSAPublicKey());
|
||||
NoByteSetSphere.addList(session.incoming, session.current.getRsaPublicKey());
|
||||
NoSessionSphere.originalHashesOnline.remove(session.getOriginalHash());
|
||||
NoSessionSphere.sessions.remove(uuid);
|
||||
session = null;
|
||||
|
||||
@@ -131,7 +131,7 @@ public class NoUser implements Serializable {
|
||||
|
||||
public final void consume(NoByteSet byteSet) throws NoByteSetBadDecryptionException {
|
||||
try {
|
||||
SecretKey secretKey = new SecretKeySpec(decryptRSA(byteSet.key), NoUtil.CIPHER_KEY_SPEC);
|
||||
SecretKey secretKey = new SecretKeySpec(decryptRsa(byteSet.key), NoUtil.CIPHER_KEY_SPEC);
|
||||
byte[] key = secretKey.getEncoded();
|
||||
secretKey = null;
|
||||
NoInfluence influence = NoInfluence.decrypt(byteSet.data, key);
|
||||
@@ -166,7 +166,7 @@ public class NoUser implements Serializable {
|
||||
return ((RSAPublicKeyImpl) publicKey).getModulus();
|
||||
}
|
||||
|
||||
public final PublicKey getRSAPublicKey() {
|
||||
public final PublicKey getRsaPublicKey() {
|
||||
try {
|
||||
return new RSAPublicKeyImpl(this.getModulus(), this.getPublicExponent());
|
||||
} catch (InvalidKeyException e) {
|
||||
@@ -178,7 +178,7 @@ public class NoUser implements Serializable {
|
||||
return influences;
|
||||
}
|
||||
|
||||
private final byte[] decryptRSA(byte[] data) throws InvalidKeyException,
|
||||
private final byte[] decryptRsa(byte[] data) throws InvalidKeyException,
|
||||
IllegalBlockSizeException, BadPaddingException {
|
||||
return NoUtil.decryptRsa(data, this.privateKey);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class NoUserTest {
|
||||
|
||||
assertNotNull(user.getNoActions());
|
||||
assertEquals(user.getNoActions().size(), 0);
|
||||
assertNotNull(user.getRSAPublicKey());
|
||||
assertNotNull(user.getRsaPublicKey());
|
||||
assertNotNull(user.getPublicExponent());
|
||||
assertNotNull(user.getModulus());
|
||||
assertEquals(user.getInfluences(), 0);
|
||||
|
||||
Reference in New Issue
Block a user