|
23 | 23 |
|
24 | 24 | encrypt_cipher = PKCS1_OAEP.new(public_key)
|
25 | 25 |
|
26 |
| -encrypted = encrypt_cipher.encrypt(secret_message) # $ CryptographicOperation CryptographicOperationInput=secret_message |
| 26 | +encrypted = encrypt_cipher.encrypt(secret_message) # $ CryptographicOperation CryptographicOperationInput=secret_message # MISSING: CryptographicOperationAlgorithm=RSA-OAEP? |
27 | 27 |
|
28 | 28 | print("encrypted={}".format(encrypted))
|
29 | 29 |
|
30 | 30 | print()
|
31 | 31 |
|
32 | 32 | decrypt_cipher = PKCS1_OAEP.new(private_key)
|
33 | 33 |
|
34 |
| -decrypted = decrypt_cipher.decrypt(encrypted) # $ CryptographicOperation CryptographicOperationInput=encrypted |
| 34 | +decrypted = decrypt_cipher.decrypt(encrypted) # $ CryptographicOperation CryptographicOperationInput=encrypted # MISSING: CryptographicOperationAlgorithm=RSA-OAEP? |
35 | 35 |
|
36 | 36 | print("decrypted={}".format(decrypted))
|
37 | 37 | assert decrypted == secret_message
|
|
50 | 50 | signer = pss.new(private_key)
|
51 | 51 |
|
52 | 52 | hasher = SHA256.new(message) # $ CryptographicOperation CryptographicOperationAlgorithm=SHA256 CryptographicOperationInput=message
|
53 |
| -signature = signer.sign(hasher) # $ CryptographicOperation CryptographicOperationInput=hasher |
| 53 | +signature = signer.sign(hasher) # $ CryptographicOperation CryptographicOperationInput=hasher # MISSING: CryptographicOperationAlgorithm=RSA-PSS? |
54 | 54 |
|
55 | 55 | print("signature={}".format(signature))
|
56 | 56 |
|
|
59 | 59 | verifier = pss.new(public_key)
|
60 | 60 |
|
61 | 61 | hasher = SHA256.new(message) # $ CryptographicOperation CryptographicOperationAlgorithm=SHA256 CryptographicOperationInput=message
|
62 |
| -verifier.verify(hasher, signature) # $ CryptographicOperation CryptographicOperationInput=hasher CryptographicOperationInput=signature |
| 62 | +verifier.verify(hasher, signature) # $ CryptographicOperation CryptographicOperationInput=hasher CryptographicOperationInput=signature # MISSING: CryptographicOperationAlgorithm=RSA-PSS? |
63 | 63 | print("Signature verified (as expected)")
|
64 | 64 |
|
65 | 65 | try:
|
66 | 66 | verifier = pss.new(public_key)
|
67 | 67 | hasher = SHA256.new(b"other message") # $ CryptographicOperation CryptographicOperationAlgorithm=SHA256 CryptographicOperationInput=b"other message"
|
68 |
| - verifier.verify(hasher, signature) # $ CryptographicOperation CryptographicOperationInput=hasher CryptographicOperationInput=signature |
| 68 | + verifier.verify(hasher, signature) # $ CryptographicOperation CryptographicOperationInput=hasher CryptographicOperationInput=signature # MISSING: CryptographicOperationAlgorithm=RSA-PSS? |
69 | 69 | raise Exception("Signature verified (unexpected)")
|
70 | 70 | except ValueError:
|
71 | 71 | print("Signature mismatch (as expected)")
|
0 commit comments