Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: trim base64 input before attempting decryption #25

Merged
merged 1 commit into from
May 2, 2024

Commits on May 2, 2024

  1. fix: trim base64 input before attempting decryption

    As the decryption input is base64-encoded, we can safely trim
    leading and trailing whitespace from it.
    
    If the input has a newline, it will fail validation, e.g:
    
    ```
    jwe="$(echo "foobar" | clevis-pin-tpm2 encrypt {})"
    echo "${jwe}" | clevis-pin-tpm2 decrypt
    Error: Error decrypting JWE
    
    Caused by:
        0: Invalid JWE format: Invalid byte 10, offset 22.
        1: Invalid byte 10, offset 22.
    ```
    
    Also include additional integration tests written in shell script.
    
    Signed-off-by: Sergio Correia <[email protected]>
    sergio-correia committed May 2, 2024
    Configuration menu
    Copy the full SHA
    36afff2 View commit details
    Browse the repository at this point in the history