Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Felix Foertsch
Luca Android
Commits
9bbd3c9c
Unverified
Commit
9bbd3c9c
authored
Dec 10, 2021
by
Felix Förtsch
Browse files
add hmac
parent
d1542001
Changes
1
Hide whitespace changes
Inline
Side-by-side
Luca/app/src/main/java/de/culture4life/luca/fake/FakeManager.java
View file @
9bbd3c9c
...
...
@@ -116,7 +116,7 @@ public class FakeManager extends Manager {
ECPublicKey
publicKey
=
checkInManager
.
getLocationPublicKey
(
scannerId
).
blockingGet
();
DeviceData
deviceData
=
new
DeviceData
();
VenueData
venueData
=
new
VenueData
(
cryptoManager
,
publicKey
,
deviceData
);
VenueData
venueData
=
new
VenueData
(
cryptoManager
,
publicKey
,
deviceData
,
checkInManager
);
CheckinData
checkinData
=
new
CheckinData
(
deviceData
,
venueData
);
...
...
@@ -132,50 +132,6 @@ public class FakeManager extends Manager {
return
random_bytes
;
}
// private QrCodeData generateFakeQrCodeData() {
// UUID userId = UUID.fromString("80caf273-2bbd-42fa-b1d7-0e5309d40d82");
//
// Single<QrCodeData> qrCodeDataSingle = Single.just(new QrCodeData())
// .flatMap(qrCodeData -> cryptoManager.getTraceIdWrapper(userId)
// .flatMapCompletable(userTraceIdWrapper -> Completable.mergeArray(
// cryptoManager.getDailyKeyPairPublicKeyWrapper()
// .map(DailyKeyPairPublicKeyWrapper::getId)
// .doOnSuccess(qrCodeData::setKeyId)
// .ignoreElement(),
// cryptoManager.getUserEphemeralKeyPair(userTraceIdWrapper.getTraceId())
// .observeOn(Schedulers.computation())
// .flatMapCompletable(keyPair -> Completable.mergeArray(
// encryptUserIdAndSecret(userId, keyPair)
// .doOnSuccess(encryptedDataAndIv -> qrCodeData.setEncryptedData(encryptedDataAndIv.first))
// .flatMap(encryptedDataAndIv -> generateVerificationTag(encryptedDataAndIv.first, userTraceIdWrapper.getTimestamp())
// .doOnSuccess(qrCodeData::setVerificationTag))
// .ignoreElement(),
// Single.just(keyPair.getPublic())
// .cast(ECPublicKey.class)
// .flatMap(publicKey -> AsymmetricCipherProvider.encode(publicKey, true))
// .doOnSuccess(qrCodeData::setUserEphemeralPublicKey)
// .ignoreElement()
// )),
// TimeUtil.encodeUnixTimestamp(userTraceIdWrapper.getTimestamp())
// .doOnSuccess(qrCodeData::setTimestamp)
// .ignoreElement(),
// Completable.fromAction(() -> qrCodeData.setTraceId(userTraceIdWrapper.getTraceId()))))
// .andThen(Single.just(qrCodeData)));
//
// return qrCodeDataSingle.blockingGet();
// }
// private CheckInRequestData generateCheckInData(@NonNull QrCodeData qrCodeData, @NonNull PublicKey locationPublicKey) {
//
//
// String serialisedMac = createQrCodeDataMac(encryptedQrCodeData, diffieHellmanSecret)
// .flatMap(SerializationUtil::serializeToBase64).blockingGet();
// checkInRequestData.setMac(serialisedMac);
//
// return checkInRequestData;
// }
public
static
RegistrationData
getFakeRegistrationData
()
{
RegistrationData
registrationData
=
new
RegistrationData
();
registrationData
.
setFirstName
(
UUID
.
randomUUID
().
toString
());
...
...
@@ -223,7 +179,7 @@ class VenueData {
String
data
;
String
hmac
;
public
VenueData
(
CryptoManager
cryptoManager
,
ECPublicKey
publicKey
,
DeviceData
deviceData
)
{
public
VenueData
(
CryptoManager
cryptoManager
,
ECPublicKey
publicKey
,
DeviceData
deviceData
,
CheckInManager
checkInManager
)
{
KeyPair
ephScannerKeys
=
cryptoManager
.
generateScannerEphemeralKeyPair
().
blockingGet
();
// dh = Diffie Hellman
...
...
@@ -239,6 +195,9 @@ class VenueData {
.
encrypt
(
deviceData
.
getDeviceData
(),
iv
,
encryptionKey
).
blockingGet
();
this
.
data
=
serializeToBase64
(
encryptedVenueData
).
blockingGet
();
byte
[]
dataAuthenticationSecret
=
cryptoManager
.
generateDataAuthenticationSecret
(
dhKeys
).
blockingGet
();
byte
[]
hmac
=
checkInManager
.
createQrCodeDataMac
(
encryptedVenueData
,
dataAuthenticationSecret
).
blockingGet
();
this
.
hmac
=
serializeToBase64
(
hmac
).
blockingGet
();
}
private
String
createPublicKeyString
(
PublicKey
ephScannerKeys
)
{
...
...
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