Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Fido2Applet
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
Wen Wei Li
Fido2Applet
Commits
14e812a7
An error occurred while fetching merge requests data.
Commit
14e812a7
authored
2 years ago
by
Josh Ji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement cx counting mechanism
parent
2472e250
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
src/main/java/com/josh/vku2f/CTAP2.java
src/main/java/com/josh/vku2f/CTAP2.java
+1
-0
src/main/java/com/josh/vku2f/IDSecret.java
src/main/java/com/josh/vku2f/IDSecret.java
+16
-5
No files found.
src/main/java/com/josh/vku2f/CTAP2.java
View file @
14e812a7
...
...
@@ -627,6 +627,7 @@ public class CTAP2 extends Applet implements ExtendedLength {
cborEncoder
.
encodeTextString
(
Utf8Strings
.
UTF8_EXTENSIONS
,
(
short
)
0
,
(
short
)
Utf8Strings
.
UTF8_EXTENSIONS
.
length
);
// add extension element
cborEncoder
.
startArray
((
short
)
2
);
idSecret
.
next
();
cborEncoder
.
encodeByteString
(
idSecret
.
hmac
,
(
short
)
0
,
(
short
)
idSecret
.
hmac
.
length
);
cborEncoder
.
encodeByteString
(
idSecret
.
encryptedCx
,
(
short
)
0
,
(
short
)
idSecret
.
encryptedCx
.
length
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/josh/vku2f/IDSecret.java
View file @
14e812a7
...
...
@@ -22,9 +22,10 @@ public class IDSecret {
public
final
byte
[]
PuKp
=
new
byte
[
65
];
public
final
byte
[]
sharedSecret
=
new
byte
[
20
];
public
final
byte
[]
hashedSharedSecret
=
new
byte
[
32
];
public
final
byte
[]
Cx
=
new
byte
[
16
];
public
final
byte
[]
Cx
=
new
byte
[
4
];
public
final
byte
[]
paddedCx
=
new
byte
[
16
];
// for pkcs#7 padding
public
final
byte
[]
encryptedCx
=
new
byte
[
16
];
public
final
byte
[]
hmac
=
new
byte
[
32
];
public
final
byte
[]
hmac
=
new
byte
[
48
];
private
AESKey
aesKey
;
private
Cipher
aesEncrypt
;
private
Cipher
aesDecrypt
;
...
...
@@ -78,7 +79,9 @@ public class IDSecret {
}
public
void
encryptCx
(){
aesEncrypt
.
doFinal
(
Cx
,
(
short
)
0
,
(
short
)
Cx
.
length
,
encryptedCx
,
(
short
)
0
);
Util
.
arrayFill
(
paddedCx
,
(
short
)
4
,
(
short
)
12
,
(
byte
)
0x0c
);
Util
.
arrayCopy
(
Cx
,
(
short
)
0
,
paddedCx
,
(
short
)
0
,
(
short
)
Cx
.
length
);
aesEncrypt
.
doFinal
(
paddedCx
,
(
short
)
0
,
(
short
)
paddedCx
.
length
,
encryptedCx
,
(
short
)
0
);
}
/**
...
...
@@ -95,10 +98,18 @@ public class IDSecret {
updateOffset
+=
(
byte
)
32
;
}
sha256
.
doFinal
(
scratch
,
updateOffset
,
scratchLength
,
scratch
,
(
short
)
0
);
Util
.
arrayFill
(
scratch
,
(
short
)
32
,
(
short
)
16
,
(
byte
)
0x10
);
aesEncrypt
.
update
(
scratch
,
(
short
)
0
,
(
short
)
16
,
outputBuffer
,
outputOffset
);
aesEncrypt
.
doFinal
(
scratch
,
(
short
)
16
,
(
short
)
16
,
outputBuffer
,
(
short
)(
outputOffset
+
16
)
);
aesEncrypt
.
update
(
scratch
,
(
short
)
16
,
(
short
)
16
,
outputBuffer
,
(
short
)(
outputOffset
+
16
)
);
aesEncrypt
.
doFinal
(
scratch
,
(
short
)
32
,
(
short
)
16
,
outputBuffer
,
(
short
)(
outputOffset
+
32
)
);
Util
.
arrayCopy
(
outputBuffer
,
(
short
)
0
,
hmac
,
(
short
)
0
,
(
short
)
32
);
Util
.
arrayCopy
(
outputBuffer
,
(
short
)
0
,
hmac
,
(
short
)
0
,
(
short
)
hmac
.
length
);
}
public
void
next
(){
plusOne
(
Cx
);
encryptCx
();
generateHMAC
(
tempBuffer
,
(
short
)
0
);
}
/**
...
...
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