17 lines
719 B
Python
17 lines
719 B
Python
import base64
|
|
|
|
# Example Base64 encoded N value
|
|
b64_n = "33dSdlKWda7L8qG94uQHfd21KnwjnbyCyMj44gTS5olb7Aejqsu8fB2lzNJhpWf6bDpFQ3iAWIXjuDQLPHGnQqHasDPEcJdlcQOJn6Sqgj2PnbuE2bBASXEefzjssDJyiZdqMWGRp41E_TlqUcoShkMjf95N_4KlvjsOTb9I99iAA3ouTWcfHA4N7Ln3fzL-BNYlVtbxTCCT-u4kyC0HewrNltZVNiJPV-FxH9FVKvqZQIv-ZCM6EgnXnU9broBZEENIEK02yYvyjqxwPnku96J4MdDItY9qyiNTzSNkHyNK0ds-kagMLT2EP7mR2EAryCv0ZDgJKQlIw4xYH91MKQ"
|
|
|
|
# 1. Decode the string
|
|
# If it's standard Base64:
|
|
# n_bytes = base64.urlsafe_b64decode(b64_n)
|
|
|
|
# If it's Base64URL (common in JWKs):
|
|
n_bytes = base64.urlsafe_b64decode(b64_n + "==")
|
|
|
|
# 2. Convert bytes to integer (Big-Endian)
|
|
n_integer = int.from_bytes(n_bytes, byteorder="big")
|
|
|
|
print(f"Integer Value: {n_integer}")
|