11package com .genexus .securityapicommons .keys ;
22
3- import java .security .NoSuchAlgorithmException ;
43import java .security .SecureRandom ;
54
65import com .genexus .securityapicommons .commons .SecurityAPIObject ;
@@ -20,10 +19,8 @@ public SymmetricKeyGenerator() {
2019 /******** EXTERNAL OBJECT PUBLIC METHODS - BEGIN ********/
2120
2221 /**
23- * @param symmetricKeyType
24- * String
25- * @param length
26- * result key length
22+ * @param symmetricKeyType String
23+ * @param length result key length
2724 * @return String Hexa fixed length secure random generated key
2825 */
2926 public String doGenerateKey (String symmetricKeyType , int length ) {
@@ -36,10 +33,8 @@ public String doGenerateKey(String symmetricKeyType, int length) {
3633 }
3734
3835 /**
39- * @param symmetricKeyType
40- * String
41- * @param length
42- * result IV length
36+ * @param symmetricKeyType String
37+ * @param length result IV length
4338 *
4439 * @return String Hexa fixed length secure random generated IV
4540 */
@@ -49,10 +44,8 @@ public String doGenerateIV(String symmetricKeyType, int length) {
4944 }
5045
5146 /**
52- * @param symmetricKeyType
53- * String
54- * @param length
55- * result nonce length
47+ * @param symmetricKeyType String
48+ * @param length result nonce length
5649 * @return String Hexa fixed length secure random generated nonce
5750 */
5851 public String doGenerateNonce (String symmetricKeyType , int length ) {
@@ -62,16 +55,15 @@ public String doGenerateNonce(String symmetricKeyType, int length) {
6255 /******** EXTERNAL OBJECT PUBLIC METHODS - END ********/
6356
6457 /**
65- * @param length
66- * int bits result key length on bits
58+ * @param length int bits result key length on bits
6759 * @return String Hexa fixed length secure random generated key
6860 */
6961 private String genericKeyGenerator (int length ) {
7062
7163 SecureRandom random = null ;
7264 try {
73- random = SecureRandom . getInstanceStrong ();
74- } catch (NoSuchAlgorithmException e ) {
65+ random = new SecureRandom ();
66+ } catch (Exception e ) {
7567 this .error .setError ("SK004" , "Key generation error" );
7668 e .printStackTrace ();
7769 }
0 commit comments