Prepend

View as MarkdownOpen in Claude

We can find the prepend by first converting our access token secret to a bytestring. We then decrypt the bytestring using our private encryption key as an RSA key with PKCS1v1.5 padding. The prepend is the resulting bytestring converted to a hex string value.

1# Replace with path to private encryption key file.
2with open("./private_encrpytion.pem", "r") as f:
3 encryption_key = RSA.importKey(f.read())
4
5bytes_decrypted_secret = PKCS1_v1_5_Cipher.new(
6 key=encryption_key
7 ).decrypt(
8 ciphertext=base64.b64decode(access_token_secret),
9 sentinel=None,
10 )
11prepend = bytes_decrypted_secret.hex()