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
05b70bf0
Commit
05b70bf0
authored
Jan 05, 2023
by
Josh Ji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test case
parent
865b39ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
src/test/java/com/prlab/idpserver/IdpServerApplicationTests.java
...t/java/com/prlab/idpserver/IdpServerApplicationTests.java
+26
-0
No files found.
src/test/java/com/prlab/idpserver/IdpServerApplicationTests.java
View file @
05b70bf0
package
com.prlab.idpserver
;
import
org.apache.tomcat.util.buf.HexUtils
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.batch.BatchProperties
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
java.sql.Types
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@SpringBootTest
class
IdpServerApplicationTests
{
@Autowired
JdbcTemplate
jdbcTemplate
;
@Test
void
contextLoads
()
{
jdbcTemplate
.
execute
(
"set block_encryption_mode='aes-256-cbc';"
);
jdbcTemplate
.
execute
(
"set @zero=unhex('00000000000000000000000000000000');"
);
String
hmac1
=
"BB69BE49C8205A6D518C22A011F03811E871D2F28B2889150A9E8B0249868D943BE0343F40420F482DAD335B59BA178B"
;
byte
[]
bytes
=
HexUtils
.
fromHexString
(
hmac1
);
String
hmac_cx_plus_1
=
"select * from identities "
+
"where ?=aes_encrypt(unhex(sha2(concat(unhex(hex(idx)),unhex(conv(conv(hex(cx), 16, 10)+1, 10, 16))), 256)), sharedsecret, @zero);"
;
List
<
Map
<
String
,
Object
>>
list
=
jdbcTemplate
.
queryForList
(
hmac_cx_plus_1
,
new
Object
[]{
bytes
},
new
int
[]{
Types
.
VARBINARY
});
list
.
forEach
(
m
->{
m
.
forEach
((
k
,
v
)->{
if
(
v
instanceof
byte
[])
System
.
out
.
println
(
k
+
": "
+
HexUtils
.
toHexString
((
byte
[])
v
));
else
System
.
out
.
println
(
k
+
": "
+
v
);
});
});
}
}
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