Skip to content

Commit df9f58b

Browse files
committed
use nextBytes instead of generateSeed. delete unused generatePassword
1 parent 05be420 commit df9f58b

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/main/java/org/kopi/ebics/certificate/KeyUtil.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,6 @@ public static KeyPair makeKeyPair(int keyLen) throws NoSuchAlgorithmException {
6161

6262
}
6363

64-
/**
65-
* Generates a random password
66-
*
67-
* @return the password
68-
*/
69-
public static String generatePassword() {
70-
String pwd = Base64.encodeBase64String(Utils.secureRandom.generateSeed(5));
71-
return pwd.substring(0, pwd.length() - 2);
72-
}
73-
7464
/**
7565
* Returns the digest value of a given public key.
7666
*

src/main/java/org/kopi/ebics/utils/Utils.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,17 @@ public static byte[] zip(byte[] toZip) throws EbicsException {
123123
* @return a random nonce.
124124
*/
125125
public static byte[] generateNonce() {
126-
return secureRandom.generateSeed(16);
126+
return nextRandomBytes(16);
127127
}
128128

129129
public static byte[] generateKey() {
130-
return secureRandom.generateSeed(16);
130+
return nextRandomBytes(16);
131+
}
132+
133+
private static byte[] nextRandomBytes(int n) {
134+
byte[] data = new byte[n];
135+
secureRandom.nextBytes(data);
136+
return data;
131137
}
132138

133139
/**

0 commit comments

Comments
 (0)