mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Rename to signal-cli
Changes experimental dbus interface from org.asamk.TextSecure to org.asamk.Signal
This commit is contained in:
parent
10719a443a
commit
eabd361405
27 changed files with 108 additions and 108 deletions
25
src/main/java/org/asamk/signal/Util.java
Normal file
25
src/main/java/org/asamk/signal/Util.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package org.asamk.signal;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
class Util {
|
||||
public static String getSecret(int size) {
|
||||
byte[] secret = getSecretBytes(size);
|
||||
return Base64.encodeBytes(secret);
|
||||
}
|
||||
|
||||
public static byte[] getSecretBytes(int size) {
|
||||
byte[] secret = new byte[size];
|
||||
getSecureRandom().nextBytes(secret);
|
||||
return secret;
|
||||
}
|
||||
|
||||
private static SecureRandom getSecureRandom() {
|
||||
try {
|
||||
return SecureRandom.getInstance("SHA1PRNG");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue