-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from spritz-group/develop
Release version v1.0.1
- Loading branch information
Showing
6 changed files
with
71 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# QRFuzz Changelogs | ||
|
||
**v1.0.1** (2023-03-16) | ||
|
||
- Re-added VerificaC19 inspector and builder from previous tests | ||
|
||
**v1.0.0** (2023-03-12) | ||
|
||
- Initial public release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from zlib import compress | ||
from binascii import unhexlify | ||
from base45 import b45encode | ||
from flynn import encoder as flynn_encoder | ||
from flynn import decoder as flynn_decoder | ||
from cose.messages import Sign1Message | ||
from cose.headers import Algorithm, KID | ||
from cose.algorithms import EdDSA | ||
from cose.keys.curves import Ed25519 | ||
from cose.keys import OKPKey | ||
from base64 import b64decode | ||
from datetime import * | ||
|
||
# -------------------- | ||
# Green Pass Builder for VerificaC19 | ||
# Script edited from ps1dr3x (github.com/ps1dr3x/greenpass-generator) | ||
# -------------------- | ||
|
||
PRIVKEY = b"9d370d925476752486ab0e4a8e088228e493da12d1586fafae9f35880dbcfe03" | ||
HEADER = b"" | ||
|
||
yesterday = datetime.timestamp(datetime.now()) - 86400 | ||
tomorrow = datetime.timestamp(datetime.now()) + (7 * 86400) | ||
|
||
def get_pass(payload: str): | ||
return {payload} | ||
|
||
def get_cose(data): | ||
return Sign1Message( | ||
phdr={Algorithm: EdDSA, KID: b64decode("NJpCsMLQco4=")}, | ||
payload=flynn_encoder.dumps(data) | ||
) | ||
|
||
def add_cose_key(msg, privkey): | ||
privkey = unhexlify(privkey) | ||
key = OKPKey(crv=Ed25519, d=privkey, optional_params={"ALG": "EDDSA"}) | ||
msg.key = key | ||
return msg | ||
|
||
def flynn(signed_encoded, header=b""): | ||
(_, (header_1, header_2, cbor_payload, sign)) = flynn_decoder.loads(signed_encoded) | ||
if header: | ||
header_1 = header | ||
return flynn_encoder.dumps((header_1, header_2, cbor_payload, sign)) | ||
|
||
def b45(msg): | ||
return b45encode(compress(msg)) | ||
|
||
def get_qr(p): | ||
msg = get_cose(get_pass(p)) | ||
msg = add_cose_key(msg, PRIVKEY) | ||
msg = flynn(msg.encode(), HEADER) | ||
msg = b45(msg) | ||
msg = b"HC1:" + msg | ||
return msg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
qrcode~=7.4.2 | ||
Pillow~=9.4.0 | ||
Pillow~=9.4.0 | ||
base45~=0.4.4 | ||
flynn~=1.0.0b2 | ||
cose~=0.9.dev8 |