Second CTFs part
This commit is contained in:
1
web-auth/keyvault/RsaCtfTool
Submodule
1
web-auth/keyvault/RsaCtfTool
Submodule
Submodule web-auth/keyvault/RsaCtfTool added at e261e73888
16
web-auth/keyvault/convert.py
Normal file
16
web-auth/keyvault/convert.py
Normal file
@@ -0,0 +1,16 @@
|
||||
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}")
|
||||
Reference in New Issue
Block a user