a43b741f1b
This allows converted ACIs and squashed images to be unique based on the specified tag. Fixes #92
16 lines
389 B
Python
16 lines
389 B
Python
import json
|
|
|
|
from hashlib import sha256
|
|
from util.canonicaljson import canonicalize
|
|
|
|
def canonical_kid(jwk):
|
|
"""This function returns the SHA256 hash of a canonical JWK.
|
|
|
|
Args:
|
|
jwk (object): the JWK for which a kid will be generated.
|
|
|
|
Returns:
|
|
string: the unique kid for the given JWK.
|
|
|
|
"""
|
|
return sha256(json.dumps(canonicalize(jwk), separators=(',', ':'))).hexdigest()
|