Padding is Invalid and Cannot Be Removed RRS feed

  • General discussion

  • If a new key is created each time a file is encrypted and decrypted, the FileCryptography.psm1 appears to work fine

    Occurs with this script

    #Create Key $key = New-CryptographyKey -Algorithm AES #Encrypt the file Protect-File '.\MySecret.txt' -Algorithm AES -Key $key -RemoveSource https://gallery.technet.microsoft.com/scriptcenter/EncryptDecrypt-files-use-65e7ae5d

    #Decrypt the file Unprotect-File '.\Mysecret.txt.AES' -Algorithm AES -Key $key -RemoveSource

    Occurs with this script

    If the file is created with a Key that converts it to the txt.AES format, then later, another attempt is made to decrypt that file, there is an error that occurs regarding the padding.

    The text used in the file (if that makes a difference) is "Mary Had A Little Lamb" (without the quotes).

    The error when running the file is "Padding is Invalid and Cannot Be Removed"

    R, J

    • Edited by Crakdkorn Thursday, January 4, 2018 9:10 PM
    • Changed type Bill_Stewart Wednesday, February 14, 2018 7:26 PM
    • Moved by Bill_Stewart Wednesday, February 14, 2018 7:27 PM This is not a support forum for gallery scripts
    Thursday, January 4, 2018 9:06 PM

All replies