5
5
6
6
package com .liferay .portal .security .password .encryptor .internal ;
7
7
8
+ import com .liferay .petra .reflect .ReflectionUtil ;
8
9
import com .liferay .petra .string .CharPool ;
9
10
import com .liferay .petra .string .StringBundler ;
10
11
import com .liferay .petra .string .StringPool ;
11
12
import com .liferay .portal .kernel .exception .PwdEncryptorException ;
12
13
import com .liferay .portal .kernel .io .BigEndianCodec ;
13
- import com .liferay .portal .kernel .log .Log ;
14
- import com .liferay .portal .kernel .log .LogFactoryUtil ;
15
14
import com .liferay .portal .kernel .security .SecureRandomUtil ;
16
15
import com .liferay .portal .kernel .security .pwd .PasswordEncryptor ;
17
16
import com .liferay .portal .kernel .util .Base64 ;
@@ -97,26 +96,26 @@ public String encrypt(
97
96
public String getEncryptionAlgorithmConfiguration (
98
97
String encryptedPassword ) {
99
98
100
- PBKDF2EncryptionConfiguration pbkdf2EncryptionConfiguration =
101
- new PBKDF2EncryptionConfiguration ();
99
+ try {
100
+ PBKDF2EncryptionConfiguration pbkdf2EncryptionConfiguration =
101
+ new PBKDF2EncryptionConfiguration ();
102
102
103
- int index = encryptedPassword .indexOf (CharPool .CLOSE_CURLY_BRACE );
103
+ int index = encryptedPassword .indexOf (CharPool .CLOSE_CURLY_BRACE );
104
104
105
- try {
106
105
pbkdf2EncryptionConfiguration .configure (
107
106
StringPool .BLANK , encryptedPassword .substring (index + 1 ));
108
- }
109
- catch (Exception exception ) {
110
- _log .error (exception );
111
- }
112
107
113
- String algorithm = encryptedPassword .substring (1 , index );
108
+ String algorithm = encryptedPassword .substring (1 , index );
114
109
115
- return StringBundler .concat (
116
- algorithm , StringPool .FORWARD_SLASH ,
117
- pbkdf2EncryptionConfiguration .getKeySize (),
118
- StringPool .FORWARD_SLASH ,
119
- pbkdf2EncryptionConfiguration .getRounds ());
110
+ return StringBundler .concat (
111
+ algorithm , StringPool .FORWARD_SLASH ,
112
+ pbkdf2EncryptionConfiguration .getKeySize (),
113
+ StringPool .FORWARD_SLASH ,
114
+ pbkdf2EncryptionConfiguration .getRounds ());
115
+ }
116
+ catch (PwdEncryptorException pwdEncryptorException ) {
117
+ return ReflectionUtil .throwException (pwdEncryptorException );
118
+ }
120
119
}
121
120
122
121
private static final int _KEY_SIZE = 160 ;
@@ -125,9 +124,6 @@ public String getEncryptionAlgorithmConfiguration(
125
124
126
125
private static final int _SALT_BYTES_LENGTH = 16 ;
127
126
128
- private static final Log _log = LogFactoryUtil .getLog (
129
- PBKDF2PasswordEncryptor .class );
130
-
131
127
private static final Pattern _pattern = Pattern .compile (
132
128
"^.*/?([0-9]+)?/([0-9]+)$" );
133
129
0 commit comments