Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IDPServer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Josh Ji
IDPServer
Commits
bacc3047
Commit
bacc3047
authored
Jan 04, 2023
by
Josh Ji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logger.info
parent
f9fb0ed0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/main/java/com/prlab/idpserver/controller/RESTfulApi.java
src/main/java/com/prlab/idpserver/controller/RESTfulApi.java
+7
-7
No files found.
src/main/java/com/prlab/idpserver/controller/RESTfulApi.java
View file @
bacc3047
...
...
@@ -33,25 +33,25 @@ public class RESTfulApi {
public
String
queryIdentity
(
@RequestBody
IdentityRequest
identityRequest
)
throws
NoSuchAlgorithmException
,
NoSuchPaddingException
,
InvalidKeyException
,
InvalidAlgorithmParameterException
,
IllegalBlockSizeException
,
BadPaddingException
{
String
sql
=
"SELECT * FROM identities WHERE HMACbase64 LIKE ?;"
;
List
<
Map
<
String
,
Object
>>
list
=
jdbcTemplate
.
queryForList
(
sql
,
new
Object
[]{
identityRequest
.
HMAC
+
"%"
},
new
int
[]{
Types
.
VARCHAR
});
logger
.
debug
(
"identityRequest : {}, {}"
,
identityRequest
.
HMAC
,
identityRequest
.
Cx
);
logger
.
info
(
"identityRequest : {}, {}"
,
identityRequest
.
HMAC
,
identityRequest
.
Cx
);
Cipher
aesCipher
=
Cipher
.
getInstance
(
"AES/CBC/NoPadding"
);
IvParameterSpec
IV
=
new
IvParameterSpec
(
new
byte
[]{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
});
logger
.
debug
(
"encryptedCx in base64 form : "
+
identityRequest
.
Cx
);
logger
.
info
(
"encryptedCx in base64 form : "
+
identityRequest
.
Cx
);
for
(
Map
<
String
,
Object
>
map
:
list
){
byte
[]
sharedSecret
=
(
byte
[])
map
.
get
(
"SharedSecret"
);
byte
[]
Cx
=
(
byte
[])
map
.
get
(
"Cx"
);
String
IDx
=
(
String
)
map
.
get
(
"IDx"
);
SecretKey
secretKey
=
new
SecretKeySpec
(
sharedSecret
,
"AES"
);
logger
.
debug
(
"IDx in db : "
+
IDx
);
logger
.
debug
(
"sharedSecret in db : "
+
HexUtils
.
toHexString
(
sharedSecret
));
logger
.
debug
(
"Cx in db : "
+
HexUtils
.
toHexString
(
Cx
));
logger
.
info
(
"IDx in db : "
+
IDx
);
logger
.
info
(
"sharedSecret in db : "
+
HexUtils
.
toHexString
(
sharedSecret
));
logger
.
info
(
"Cx in db : "
+
HexUtils
.
toHexString
(
Cx
));
aesCipher
.
init
(
Cipher
.
DECRYPT_MODE
,
secretKey
,
IV
);
byte
[]
encryptedCx
=
Base64Utils
.
decodeFromString
(
identityRequest
.
Cx
);
logger
.
debug
(
"encryptedCx : "
+
HexUtils
.
toHexString
(
encryptedCx
));
logger
.
info
(
"encryptedCx : "
+
HexUtils
.
toHexString
(
encryptedCx
));
byte
[]
decryptedCx
=
aesCipher
.
doFinal
(
encryptedCx
,
0
,
16
);
logger
.
debug
(
"decryptedCx : "
+
HexUtils
.
toHexString
(
decryptedCx
));
logger
.
info
(
"decryptedCx : "
+
HexUtils
.
toHexString
(
decryptedCx
));
if
(
Arrays
.
equals
(
Cx
,
decryptedCx
)){
return
IDx
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment