Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDDE21 DRIP 2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Viktor Norgren
TDDE21 DRIP 2023
Commits
1b32fe82
Commit
1b32fe82
authored
2 years ago
by
Abdullah Bin Zubair
Browse files
Options
Downloads
Patches
Plain Diff
Updated New functionalities for All SAM types
parent
7479a08d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iroha-drip-general-master/bluetooth/host_identity_1.py
+26
-2
26 additions, 2 deletions
iroha-drip-general-master/bluetooth/host_identity_1.py
with
26 additions
and
2 deletions
iroha-drip-general-master/bluetooth/host_identity_1.py
+
26
−
2
View file @
1b32fe82
...
@@ -74,13 +74,37 @@ class HostIdentity:
...
@@ -74,13 +74,37 @@ class HostIdentity:
sign_key
=
SigningKey
(
unhexlify
(
self
.
_priv_key
))
sign_key
=
SigningKey
(
unhexlify
(
self
.
_priv_key
))
return
hexlify
(
sign_key
.
sign
(
unhexlify
(
message
)))
return
hexlify
(
sign_key
.
sign
(
unhexlify
(
message
)))
## Function for DRIP_Wrapper
def
generate_self_attestation_Wrapper
(
self
,
payload
,
expiration
):
if
expiration
<=
astm_time
():
print
(
"
expiration timestamp has already expired.
"
)
return
None
#hash of SAM Type for Wrapper, which is 0x02
hash_SAM
=
cSHAKE128
(
'
0x02
'
,
1
,
""
,
""
)
message
=
hash_SAM
+
self
.
_hhit
+
payload
+
"
{:>08x}
"
.
format
(
convert_be_to_le
(
astm_time
()))
+
"
{:>08x}
"
.
format
(
convert_be_to_le
(
expiration
))
sign_key
=
SigningKey
(
unhexlify
(
self
.
_priv_key
))
return
hexlify
(
sign_key
.
sign
(
unhexlify
(
message
)))
## Function for DRIP_Manifests
def
generate_self_attestation_Manifests
(
self
,
prev_hashed_loc
,
hashed_loc
,
expiration
):
#hashed_loc is hashes of location for now its single, but it can be upto 11(Each 8 byte)
if
expiration
<=
astm_time
():
print
(
"
expiration timestamp has already expired.
"
)
return
None
#hash of SAM Type for Manifests, which is 0x03
hash_SAM
=
cSHAKE128
(
'
0x03
'
,
1
,
""
,
""
)
message
=
hash_SAM
+
self
.
_hhit
+
prev_hashed_loc
+
hashed_loc
+
"
{:>08x}
"
.
format
(
convert_be_to_le
(
astm_time
()))
+
"
{:>08x}
"
.
format
(
convert_be_to_le
(
expiration
))
sign_key
=
SigningKey
(
unhexlify
(
self
.
_priv_key
))
return
hexlify
(
sign_key
.
sign
(
unhexlify
(
message
)))
def
generate_
self_concise_attestation
(
self
,
expiration
):
def
generate_
attestation_Endorsement_Broadcast
(
self
,
Drone_hhit
,
Drone_hid
,
expiration
):
if
expiration
<=
astm_time
():
if
expiration
<=
astm_time
():
print
(
"
expiration timestamp has already expired.
"
)
print
(
"
expiration timestamp has already expired.
"
)
return
None
return
None
message
=
self
.
_hhit
+
"
{:>08x}
"
.
format
(
convert_be_to_le
(
expiration
))
message
=
self
.
_hhit
+
Drone_hhit
+
Drone_hid
+
"
{:>08x}
"
.
format
(
convert_be_to_le
(
astm_time
()))
+
"
{:>08x}
"
.
format
(
convert_be_to_le
(
expiration
))
sign_key
=
SigningKey
(
unhexlify
(
self
.
_priv_key
))
sign_key
=
SigningKey
(
unhexlify
(
self
.
_priv_key
))
return
sign_key
.
sign
(
unhexlify
(
message
))
return
sign_key
.
sign
(
unhexlify
(
message
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment