Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
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
16b5f7b6
Commit
16b5f7b6
authored
Oct 03, 2022
by
Josh Ji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement SharePIN
parent
880b40ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
9 deletions
+44
-9
.idea/.name
.idea/.name
+0
-1
.idea/misc.xml
.idea/misc.xml
+3
-0
src/main/java/josh/passport/PassportApplet.java
src/main/java/josh/passport/PassportApplet.java
+31
-8
src/main/java/josh/passport/SharePIN.java
src/main/java/josh/passport/SharePIN.java
+10
-0
No files found.
.idea/.name
deleted
100644 → 0
View file @
880b40ed
passportApplet
\ No newline at end of file
.idea/misc.xml
View file @
16b5f7b6
...
...
@@ -7,4 +7,7 @@
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
default=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/out"
/>
</component>
<component
name=
"ProjectType"
>
<option
name=
"id"
value=
"jpab"
/>
</component>
</project>
\ No newline at end of file
src/main/java/josh/passport/PassportApplet.java
View file @
16b5f7b6
...
...
@@ -22,13 +22,7 @@
package
josh.passport
;
import
javacard.framework.APDU
;
import
javacard.framework.Applet
;
import
javacard.framework.CardRuntimeException
;
import
javacard.framework.ISO7816
;
import
javacard.framework.ISOException
;
import
javacard.framework.JCSystem
;
import
javacard.framework.Util
;
import
javacard.framework.*
;
import
javacard.security.RandomData
;
import
javacard.security.Signature
;
import
javacardx.crypto.Cipher
;
...
...
@@ -46,7 +40,7 @@ import javacardx.crypto.Cipher;
*
* @version $Revision$
*/
public
class
PassportApplet
extends
Applet
implements
ISO7816
{
public
class
PassportApplet
extends
Applet
implements
ISO7816
,
SharePIN
{
static
byte
volatileState
[];
static
byte
persistentState
;
...
...
@@ -1114,4 +1108,33 @@ public class PassportApplet extends Applet implements ISO7816 {
return
(
volatileState
[
0
]
&
TERMINAL_AUTHENTICATED
)
==
TERMINAL_AUTHENTICATED
;
}
byte
[]
sharedPIN
=
new
byte
[]{
't'
,
'e'
,
's'
,
't'
,
'p'
,
'i'
,
'n'
,};
final
short
sharedSecret
=
(
short
)
87
;
@Override
public
Shareable
getShareableInterfaceObject
(
AID
aid
,
byte
b
)
{
if
(
aid
.
equals
(
new
byte
[]{(
byte
)
0xa0
,(
byte
)
0x00
,(
byte
)
0x00
,(
byte
)
0x06
,(
byte
)
0x47
,(
byte
)
0x2f
,(
byte
)
0x00
,(
byte
)
0x01
},
(
short
)
0
,
(
byte
)
0
)){
return
this
;
}
return
this
;
}
@Override
public
void
setSharedPIN
(
byte
[]
apduBuffer
,
short
offset
,
short
length
)
{
sharedPIN
=
new
byte
[
length
];
JCSystem
.
requestObjectDeletion
();
Util
.
arrayCopy
(
apduBuffer
,
offset
,
sharedPIN
,
(
short
)
0
,
length
);
}
@Override
public
short
getSharedPIN
(
byte
[]
apduBuffer
,
short
offset
)
{
Util
.
arrayCopy
(
sharedPIN
,
(
short
)
0
,
apduBuffer
,
offset
,
(
short
)
sharedPIN
.
length
);
return
(
short
)
sharedPIN
.
length
;
}
@Override
public
short
getSecret
()
{
return
sharedSecret
;
}
}
src/main/java/josh/passport/SharePIN.java
0 → 100644
View file @
16b5f7b6
package
josh.passport
;
import
javacard.framework.Shareable
;
public
interface
SharePIN
extends
Shareable
{
void
setSharedPIN
(
byte
[]
apduBuffer
,
short
offset
,
short
length
);
short
getSharedPIN
(
byte
[]
apduBuffer
,
short
offset
);
short
getSecret
();
}
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