name refactors

This commit is contained in:
Dave
2015-06-29 22:34:47 +02:00
parent 178616adcb
commit 1e543bafc1
5 changed files with 12 additions and 12 deletions

View File

@@ -28,7 +28,7 @@ import java.nio.file.StandardOpenOption;
import nodash.exceptions.NoDashFatalException; 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 long serialVersionUID = -8498303909736017075L;
private static final String CONFIG_FILENAME = "noconfig.cfg"; private static final String CONFIG_FILENAME = "noconfig.cfg";

View File

@@ -46,9 +46,9 @@ public final class NoByteSetSphere {
} }
public static List<NoByteSet> consume(NoUser user) { public static List<NoByteSet> consume(NoUser user) {
if (NoByteSetSphere.byteSets.containsKey(user.getRSAPublicKey())) { if (NoByteSetSphere.byteSets.containsKey(user.getRsaPublicKey())) {
ArrayList<NoByteSet> result = NoByteSetSphere.byteSets.get(user.getRSAPublicKey()); ArrayList<NoByteSet> result = NoByteSetSphere.byteSets.get(user.getRsaPublicKey());
NoByteSetSphere.byteSets.remove(user.getRSAPublicKey()); NoByteSetSphere.byteSets.remove(user.getRsaPublicKey());
return result; return result;
} else { } else {
return NoByteSetSphere.EMPTY_BYTESET_LIST; return NoByteSetSphere.EMPTY_BYTESET_LIST;

View File

@@ -52,12 +52,12 @@ public final class NoSessionSphere {
} }
} }
public static void shred(byte[] encryptedUUID) { public static void shred(byte[] encryptedUuid) {
try { try {
UUID uuid = NoSession.decryptUuid(encryptedUUID); UUID uuid = NoSession.decryptUuid(encryptedUuid);
if (NoSessionSphere.sessions.containsKey(uuid)) { if (NoSessionSphere.sessions.containsKey(uuid)) {
NoSession session = NoSessionSphere.sessions.get(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 NoSessionSphere.originalHashesOnline.remove(Base64.encodeBase64String(session
.getOriginalHash())); .getOriginalHash()));
NoSessionSphere.sessions.remove(uuid); NoSessionSphere.sessions.remove(uuid);
@@ -74,7 +74,7 @@ public final class NoSessionSphere {
session.check(); session.check();
} catch (NoSessionExpiredException e) { } catch (NoSessionExpiredException e) {
/* Resultant from 3.1 and 3.2 */ /* 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.originalHashesOnline.remove(session.getOriginalHash());
NoSessionSphere.sessions.remove(uuid); NoSessionSphere.sessions.remove(uuid);
session = null; session = null;

View File

@@ -131,7 +131,7 @@ public class NoUser implements Serializable {
public final void consume(NoByteSet byteSet) throws NoByteSetBadDecryptionException { public final void consume(NoByteSet byteSet) throws NoByteSetBadDecryptionException {
try { 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(); byte[] key = secretKey.getEncoded();
secretKey = null; secretKey = null;
NoInfluence influence = NoInfluence.decrypt(byteSet.data, key); NoInfluence influence = NoInfluence.decrypt(byteSet.data, key);
@@ -166,7 +166,7 @@ public class NoUser implements Serializable {
return ((RSAPublicKeyImpl) publicKey).getModulus(); return ((RSAPublicKeyImpl) publicKey).getModulus();
} }
public final PublicKey getRSAPublicKey() { public final PublicKey getRsaPublicKey() {
try { try {
return new RSAPublicKeyImpl(this.getModulus(), this.getPublicExponent()); return new RSAPublicKeyImpl(this.getModulus(), this.getPublicExponent());
} catch (InvalidKeyException e) { } catch (InvalidKeyException e) {
@@ -178,7 +178,7 @@ public class NoUser implements Serializable {
return influences; return influences;
} }
private final byte[] decryptRSA(byte[] data) throws InvalidKeyException, private final byte[] decryptRsa(byte[] data) throws InvalidKeyException,
IllegalBlockSizeException, BadPaddingException { IllegalBlockSizeException, BadPaddingException {
return NoUtil.decryptRsa(data, this.privateKey); return NoUtil.decryptRsa(data, this.privateKey);
} }

View File

@@ -28,7 +28,7 @@ public class NoUserTest {
assertNotNull(user.getNoActions()); assertNotNull(user.getNoActions());
assertEquals(user.getNoActions().size(), 0); assertEquals(user.getNoActions().size(), 0);
assertNotNull(user.getRSAPublicKey()); assertNotNull(user.getRsaPublicKey());
assertNotNull(user.getPublicExponent()); assertNotNull(user.getPublicExponent());
assertNotNull(user.getModulus()); assertNotNull(user.getModulus());
assertEquals(user.getInfluences(), 0); assertEquals(user.getInfluences(), 0);