SubServers, Host, & Client v2.12c/2.12d/2.12c

This commit is contained in:
ME1312 2017-07-25 19:23:41 -04:00
parent e766f7fa22
commit c34b097676
13 changed files with 52 additions and 97 deletions

Binary file not shown.

Binary file not shown.

View File

@ -111,7 +111,11 @@ var activeTableTab = "activeTableTab";
extends java.lang.Object</pre>
<div class="block">A class to perform password-based AES encryption and decryption in CBC mode.
128, 192, and 256-bit encryption are supported, provided that the latter two
are permitted by the Java runtime's jurisdiction policy files.</div>
are permitted by the Java runtime's jurisdiction policy files.
<br/>
The public interface for this class consists of the static methods
<a href="../../../../../net/ME1312/SubServers/Bungee/Network/AES.html#encrypt-int-java.lang.String-java.io.InputStream-java.io.OutputStream-"><code>encrypt(int, java.lang.String, java.io.InputStream, java.io.OutputStream)</code></a> and <a href="../../../../../net/ME1312/SubServers/Bungee/Network/AES.html#decrypt-java.lang.String-java.io.InputStream-java.io.OutputStream-"><code>decrypt(java.lang.String, java.io.InputStream, java.io.OutputStream)</code></a>, which encrypt and decrypt arbitrary
streams of data, respectively.</div>
<dl>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>dweymouth@gmail.com</dd>

View File

@ -1,5 +1,5 @@
Manifest-Version: 1.0
Class-Path: BungeeCord.jar
Main-Class: net.ME1312.SubServers.Bungee.Launch
Implementation-Version: 2.12b
Implementation-Version: 2.12c
Specification-Version: 0

View File

@ -215,7 +215,6 @@ public final class Util {
ZipOutputStream zos = new ZipOutputStream(zip);
for(String next : zipsearch(file, file)){
ZipEntry ze= new ZipEntry(next);
zos.putNextEntry(ze);

View File

@ -1,21 +1,31 @@
package net.ME1312.SubServers.Bungee.Network;
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
import net.ME1312.SubServers.Bungee.Library.Util;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.*;
import java.security.spec.*;
import java.util.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.InvalidParameterSpecException;
import java.security.spec.KeySpec;
import java.util.Arrays;
import java.util.Random;
/**
* A class to perform password-based AES encryption and decryption in CBC mode.
* 128, 192, and 256-bit encryption are supported, provided that the latter two
* are permitted by the Java runtime's jurisdiction policy files.
* <br/>
* The public interface for this class consists of the static methods
* {@link #encrypt} and {@link #decrypt}, which encrypt and decrypt arbitrary
* streams of data, respectively.
*
* @author dweymouth@gmail.com
*/
@ -179,16 +189,9 @@ public final class AES {
* @throws IOException
*/
public static byte[] encrypt(int keyLength, String password, String input) throws IOException, StrongEncryptionNotAvailableException, InvalidKeyLengthException {
List<Byte> list = new LinkedList<Byte>();
encrypt(keyLength, password, new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)), new OutputStream() {
@Override
public void write(int b) throws IOException {
list.add((byte) b);
}
});
byte[] array = new byte[list.size()];
for(int i = 0; i < list.size(); i++) array[i] = list.get(i);
return array;
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
encrypt(keyLength, password, new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)), bytes);
return bytes.toByteArray();
}
/**
@ -281,16 +284,9 @@ public final class AES {
* @throws IOException
*/
public static NamedContainer<Integer, String> decrypt(String password, byte[] input) throws IOException, StrongEncryptionNotAvailableException, InvalidAESStreamException, InvalidPasswordException {
List<Byte> list = new LinkedList<Byte>();
int keyLength = decrypt(password, new ByteArrayInputStream(input), new OutputStream() {
@Override
public void write(int b) throws IOException {
list.add((byte) b);
}
});
byte[] array = new byte[list.size()];
for(int i = 0; i < list.size(); i++) array[i] = list.get(i);
return new NamedContainer<>(keyLength, new String(array, StandardCharsets.UTF_8));
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
int keyLength = decrypt(password, new ByteArrayInputStream(input), bytes);
return new NamedContainer<>(keyLength, new String(bytes.toByteArray(), StandardCharsets.UTF_8));
}
/**

View File

@ -12,11 +12,9 @@ import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.*;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
@ -56,16 +54,9 @@ public class PacketExConfigureHost implements PacketIn, PacketOut {
tinfo.put("enabled", template.isEnabled());
tinfo.put("display", template.getDisplayName());
tinfo.put("icon", template.getIcon());
List<Byte> list = new LinkedList<Byte>();
Util.zip(template.getDirectory(), new OutputStream() {
@Override
public void write(int b) throws IOException {
list.add((byte) b);
}
});
byte[] array = new byte[list.size()];
for (int i = 0; i < list.size(); i++) array[i] = list.get(i);
tinfo.put("files", Base64.getEncoder().encodeToString(array));
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
Util.zip(template.getDirectory(), bytes);
tinfo.put("files", Base64.getEncoder().encodeToString(bytes.toByteArray()));
tinfo.put("build", template.getBuildOptions().toJSON());
tinfo.put("settings", template.getConfigOptions().toJSON());
templates.put(template.getName(), tinfo);

View File

@ -6,10 +6,7 @@ import javax.crypto.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
@ -19,8 +16,6 @@ import java.security.spec.InvalidKeySpecException;
import java.security.spec.InvalidParameterSpecException;
import java.security.spec.KeySpec;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
/**
@ -194,16 +189,9 @@ public final class AES {
* @throws IOException
*/
public static byte[] encrypt(int keyLength, String password, String input) throws IOException, StrongEncryptionNotAvailableException, InvalidKeyLengthException {
List<Byte> list = new LinkedList<Byte>();
encrypt(keyLength, password, new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)), new OutputStream() {
@Override
public void write(int b) throws IOException {
list.add((byte) b);
}
});
byte[] array = new byte[list.size()];
for(int i = 0; i < list.size(); i++) array[i] = list.get(i);
return array;
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
encrypt(keyLength, password, new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)), bytes);
return bytes.toByteArray();
}
/**
@ -296,16 +284,9 @@ public final class AES {
* @throws IOException
*/
public static NamedContainer<Integer, String> decrypt(String password, byte[] input) throws IOException, StrongEncryptionNotAvailableException, InvalidAESStreamException, InvalidPasswordException {
List<Byte> list = new LinkedList<Byte>();
int keyLength = decrypt(password, new ByteArrayInputStream(input), new OutputStream() {
@Override
public void write(int b) throws IOException {
list.add((byte) b);
}
});
byte[] array = new byte[list.size()];
for(int i = 0; i < list.size(); i++) array[i] = list.get(i);
return new NamedContainer<>(keyLength, new String(array, StandardCharsets.UTF_8));
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
int keyLength = decrypt(password, new ByteArrayInputStream(input), bytes);
return new NamedContainer<>(keyLength, new String(bytes.toByteArray(), StandardCharsets.UTF_8));
}
/**

View File

@ -1,6 +1,6 @@
name: 'SubServers-Client-Bukkit'
main: 'net.ME1312.SubServers.Client.Bukkit.SubPlugin'
version: '2.12b'
version: '2.12c'
authors: [ME1312]
softdepend: [Vault, TitleManager]
website: 'http://www.ME1312.net/'

View File

@ -47,7 +47,7 @@ public final class ExHost {
public YAMLSection lang = null;
public SubDataClient subdata = null;
public final Version version = new Version("2.12c");
public final Version version = new Version("2.12d");
public final Version bversion = null;
public final SubAPI api = new SubAPI(this);

View File

@ -6,10 +6,7 @@ import javax.crypto.*;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
@ -194,16 +191,9 @@ public final class AES {
* @throws IOException
*/
public static byte[] encrypt(int keyLength, String password, String input) throws IOException, StrongEncryptionNotAvailableException, InvalidKeyLengthException {
List<Byte> list = new LinkedList<Byte>();
encrypt(keyLength, password, new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)), new OutputStream() {
@Override
public void write(int b) throws IOException {
list.add((byte) b);
}
});
byte[] array = new byte[list.size()];
for(int i = 0; i < list.size(); i++) array[i] = list.get(i);
return array;
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
encrypt(keyLength, password, new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8)), bytes);
return bytes.toByteArray();
}
/**
@ -296,16 +286,9 @@ public final class AES {
* @throws IOException
*/
public static NamedContainer<Integer, String> decrypt(String password, byte[] input) throws IOException, StrongEncryptionNotAvailableException, InvalidAESStreamException, InvalidPasswordException {
List<Byte> list = new LinkedList<Byte>();
int keyLength = decrypt(password, new ByteArrayInputStream(input), new OutputStream() {
@Override
public void write(int b) throws IOException {
list.add((byte) b);
}
});
byte[] array = new byte[list.size()];
for(int i = 0; i < list.size(); i++) array[i] = list.get(i);
return new NamedContainer<>(keyLength, new String(array, StandardCharsets.UTF_8));
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
int keyLength = decrypt(password, new ByteArrayInputStream(input), bytes);
return new NamedContainer<>(keyLength, new String(bytes.toByteArray(), StandardCharsets.UTF_8));
}
/**

View File

@ -39,6 +39,7 @@ public class PacketExConfigureHost implements PacketIn, PacketOut {
@Override
public JSONObject generate() {
host.log.info.println("Downloading Host Settings...");
return null;
}