make keys more secure

This commit is contained in:
Daniella / Tove 2024-06-09 17:01:33 +02:00
parent d38a801404
commit f3508cb27f
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 12 additions and 10 deletions

View file

@ -39,14 +39,6 @@ javadoc {
new URL("https://raw.githubusercontent.com/TudbuT/tools/master/dark_javadoc.css").newInputStream().
readLines().join("\n").getBytes()
); f.close()
}
}
jar {
doLast {
File jar = new File("build/libs/tuddylib.jar")
File loc = new File("TuddyLIB.jar")
jar.renameTo(loc)
ZipOutputStream out = new ZipOutputStream(new FileOutputStream("TuddyLIB-javadoc.zip"))
new File("build/docs/javadoc").eachFileRecurse(groovy.io.FileType.FILES) {
@ -60,6 +52,14 @@ jar {
}
}
jar {
doLast {
File jar = new File("build/libs/tuddylib.jar")
File loc = new File("TuddyLIB.jar")
jar.renameTo(loc)
}
}
//jar.dependsOn("javadoc")
publishing {

View file

@ -5,6 +5,8 @@ import de.tudbut.tools.Hasher;
import de.tudbut.tools.ObjectSerializerTCN;
import de.tudbut.tools.Tools;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.util.Objects;
/**
@ -18,7 +20,7 @@ public class Key implements Cloneable {
* Generates a random Key
*/
public Key() {
string = Tools.randomAlphanumericString(1024);
this(SecureRandom.getSeed(1024));
}
/**
@ -34,7 +36,7 @@ public class Key implements Cloneable {
* @param bytes Key as byte[]
*/
public Key(byte[] bytes) {
string = new String(bytes);
string = new String(bytes, StandardCharsets.ISO_8859_1);
}
/**