PowerShell / SecretManagement

PowerShell module to consistent usage of secrets through different extension vaults
MIT License
317 stars 46 forks source link

Get-SecretInfo : Exception calling "GetInstance" with "0" argument(s): "Padding is invalid and cannot be removed." #210

Open akselbork opened 1 year ago

akselbork commented 1 year ago

Prerequisites

Steps to reproduce

When I try to get the vault information to get my secrets it give me multiple errors

Expected behavior

Should give me information an which secrets is in each vault

Actual behavior

I ♥ PS > Get-SecretInfo
Get-SecretInfo : Exception calling "GetInstance" with "0" argument(s): "Padding is invalid and cannot be removed."
At line:1 char:1
+ Get-SecretInfo
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SecretInfo], MethodInvocationException
    + FullyQualifiedErrorId : CryptographicException,Microsoft.PowerShell.SecretManagement.GetSecretInfoCommand

Get-SecretInfo : Exception calling "GetInstance" with "0" argument(s): "Padding is invalid and cannot be removed."
At line:1 char:1
+ Get-SecretInfo
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SecretInfo], MethodInvocationException
    + FullyQualifiedErrorId : CryptographicException,Microsoft.PowerShell.SecretManagement.GetSecretInfoCommand

Get-SecretInfo : Exception calling "GetInstance" with "0" argument(s): "Padding is invalid and cannot be removed."
At line:1 char:1
+ Get-SecretInfo
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SecretInfo], MethodInvocationException
    + FullyQualifiedErrorId : CryptographicException,Microsoft.PowerShell.SecretManagement.GetSecretInfoCommand

Get-SecretInfo : Exception calling "GetInstance" with "0" argument(s): "Padding is invalid and cannot be removed."
At line:1 char:1
+ Get-SecretInfo
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SecretInfo], MethodInvocationException
    + FullyQualifiedErrorId : CryptographicException,Microsoft.PowerShell.SecretManagement.GetSecretInfoCommand

Get-SecretInfo : Exception calling "GetInstance" with "0" argument(s): "Padding is invalid and cannot be removed."
At line:1 char:1
+ Get-SecretInfo
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SecretInfo], MethodInvocationException
    + FullyQualifiedErrorId : CryptographicException,Microsoft.PowerShell.SecretManagement.GetSecretInfoCommand

Get-SecretInfo : Exception calling "GetInstance" with "0" argument(s): "Padding is invalid and cannot be removed."
At line:1 char:1
+ Get-SecretInfo
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SecretInfo], MethodInvocationException
    + FullyQualifiedErrorId : CryptographicException,Microsoft.PowerShell.SecretManagement.GetSecretInfoCommand

Error details

I ♥ PS > $error[0] | fl * -Force

writeErrorStream      : True
PSMessageDetails      :
Exception             : System.Management.Automation.MethodInvocationException: Exception calling "GetInstance" with "0" argument(s): "Padding is invalid and cannot be removed." ---> System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
                           at System.Security.Cryptography.CapiSymmetricAlgorithm.DepadBlock(Byte[] block, Int32 offset, Int32 count)
                           at System.Security.Cryptography.CapiSymmetricAlgorithm.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
                           at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
                           at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing)
                           at System.IO.Stream.Close()
                           at Microsoft.PowerShell.SecretStore.CryptoUtils.DecryptWithKey(SecureString passWord, AesKey key, Byte[] data)
                           at Microsoft.PowerShell.SecretStore.SecureStoreFile.ReadConfigFile(SecureStoreConfig& configData, String& errorMsg)
                           at Microsoft.PowerShell.SecretStore.SecureStore.GetStore(SecureString password)
                           at Microsoft.PowerShell.SecretStore.LocalSecretStore.GetInstance(SecureString password, PSCmdlet cmdlet)
                           at CallSite.Target(Closure , CallSite , Type )
                           --- End of inner exception stack trace ---
                           at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
                           at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject          :
CategoryInfo          : NotSpecified: (:) [Get-SecretInfo], MethodInvocationException
FullyQualifiedErrorId : CryptographicException,Microsoft.PowerShell.SecretManagement.GetSecretInfoCommand
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Get-SecretInfo, C:\Program Files\WindowsPowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.3\Microsoft.PowerShell.SecretStore.Extension\Microsoft.PowerShell.SecretStore.Extension.psm1: line 71
                        at <ScriptBlock>, <No file>: line 19
PipelineIterationInfo : {0, 1}

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.2364
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.2364
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

1.1.2

Visuals

No response