Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PassportApplet
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
PassportApplet
Commits
e2939205
An error occurred while fetching merge requests data.
Commit
e2939205
authored
3 years ago
by
Josh Ji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code review
parent
a1b44688
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
21 deletions
+15
-21
.gitignore
.gitignore
+4
-1
build.gradle
build.gradle
+0
-9
src/main/java/josh/passport/PassportApplet.java
src/main/java/josh/passport/PassportApplet.java
+11
-11
No files found.
.gitignore
View file @
e2939205
# Project exclude paths
/.gradle/
/build/
\ No newline at end of file
/build/
.idea
.idea/jarRepositories.xml
.idea/jarRepositories.xml
This diff is collapsed.
Click to expand it.
build.gradle
View file @
e2939205
...
...
@@ -2,7 +2,6 @@ buildscript{
repositories
{
mavenCentral
()
maven
{
url
'https://javacard.pro/maven'
}
maven
{
url
'https://deadcode.me/mvn'
}
}
dependencies
{
classpath
'com.klinec:gradle-javacard:1.8.0'
...
...
@@ -22,20 +21,12 @@ sourceCompatibility = 1.8
repositories
{
mavenCentral
()
maven
{
url
'https://javacard.pro/maven'
}
maven
{
url
'https://deadcode.me/mvn'
}
flatDir
{
dirs
'libs'
}
}
dependencies
{
testImplementation
'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntimeOnly
'org.junit.jupiter:junit-jupiter-engine'
}
test
{
useJUnitPlatform
()
}
final
def
sdk_dir
=
'sdks/jc304_kit'
javacard
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/josh/passport/PassportApplet.java
View file @
e2939205
...
...
@@ -240,7 +240,7 @@ public class PassportApplet extends Applet implements ISO7816 {
byte
cla
=
buffer
[
OFFSET_CLA
];
byte
ins
=
buffer
[
OFFSET_INS
];
short
sw1sw2
=
SW_OK
;
boolean
protectedApdu
=
(
byte
)(
cla
&
CLA_PROTECTED_APDU
)
==
CLA_PROTECTED_APDU
;
boolean
protectedApdu
=
(
byte
)(
cla
&
CLA_PROTECTED_APDU
)
==
CLA_PROTECTED_APDU
;
// 0x0c
short
responseLength
=
0
;
short
le
=
0
;
...
...
@@ -271,7 +271,7 @@ public class PassportApplet extends Applet implements ISO7816 {
sw1sw2
=
e
.
getReason
();
}
}
else
if
(
protectedApdu
)
{
ISOException
.
throwIt
(
ISO7816
.
SW_SECURE_MESSAGING_NOT_SUPPORTED
);
ISOException
.
throwIt
(
ISO7816
.
SW_SECURE_MESSAGING_NOT_SUPPORTED
);
// 0x6882
}
if
(
sw1sw2
==
SW_OK
)
{
...
...
@@ -337,7 +337,7 @@ public class PassportApplet extends Applet implements ISO7816 {
case
INS_INTERNAL_AUTHENTICATE:
//defined in 9303-11
responseLength
=
processInternalAuthenticate
(
apdu
,
protectedApdu
);
break
;
case
INS_SELECT_FILE:
//defined in 9303-10
case
INS_SELECT_FILE:
//defined in 9303-10
// 0xa4
responseLength
=
processSelectFile
(
apdu
);
break
;
case
INS_READ_BINARY:
//defined in 9303-10
...
...
@@ -638,14 +638,14 @@ public class PassportApplet extends Applet implements ISO7816 {
}
}
else
if
(
p2
==
CVCERTIFICATE_TAG
)
{
if
((
byte
)
(
persistentState
&
HAS_CVCERTIFICATE
)
==
HAS_CVCERTIFICATE
)
{
// We already have the certificate initialized
ISOException
.
throwIt
(
SW_CONDITIONS_NOT_SATISFIED
);
if
((
byte
)
(
persistentState
&
HAS_CVCERTIFICATE
)
==
HAS_CVCERTIFICATE
)
{
// We already have the certificate initialized
ISOException
.
throwIt
(
SW_CONDITIONS_NOT_SATISFIED
);
}
certificate
.
parseCertificate
(
buffer
,
buffer_p
,
lc
,
true
);
certificate
.
setRootCertificate
(
buffer
,
p1
);
persistentState
|=
HAS_CVCERTIFICATE
;
}
certificate
.
parseCertificate
(
buffer
,
buffer_p
,
lc
,
true
);
certificate
.
setRootCertificate
(
buffer
,
p1
);
persistentState
|=
HAS_CVCERTIFICATE
;
}
else
{
ISOException
.
throwIt
(
SW_INCORRECT_P1P2
);
}
...
...
@@ -662,7 +662,7 @@ public class PassportApplet extends Applet implements ISO7816 {
*/
private
short
processInternalAuthenticate
(
APDU
apdu
,
boolean
protectedApdu
)
{
if
(!
hasInternalAuthenticationKeys
()
||
!
hasMutuallyAuthenticated
())
{
ISOException
.
throwIt
(
ISO7816
.
SW_SECURITY_STATUS_NOT_SATISFIED
);
ISOException
.
throwIt
(
ISO7816
.
SW_SECURITY_STATUS_NOT_SATISFIED
);
//6982
}
short
buffer_p
=
(
short
)
(
OFFSET_CDATA
&
0xff
);
...
...
This diff is collapsed.
Click to expand it.
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