diff mbox series

[swugenerator,3/3] fix: correct PKCS#11 mechanism usage in signing command

Message ID 20250730135151.4186-3-pratikmanvar09@gmail.com
State Accepted
Headers show
Series [swugenerator,1/3] fix: add missing `decrypted-size` entry | expand

Commit Message

Pratik Manvar July 30, 2025, 1:51 p.m. UTC
From: Pratik Manvar <pratik.manvar@ifm.com>

Fix an issue where the pkcs11-tool was invoked with an empty mechanism
due to a space after `-m ` flag. This caused signing to fail with the
error "Unknown PKCS11 mechanism".

So, remove space after `-m` to fix PKCS#11 mechanism error as below.
  ['-m ', 'SHA256-RSA-PKCS']
  ['-m', 'SHA256-RSA-PKCS']

The mechanism should now correctly set to `SHA256-RSA-PKCS`.

Signed-off-by: Pratik Manvar <pratik.manvar@ifm.com>
---
 swugenerator/swu_sign.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Babic Aug. 4, 2025, 10:33 a.m. UTC | #1
On 7/30/25 15:51, Pratik Manvar wrote:
> From: Pratik Manvar <pratik.manvar@ifm.com>
> 
> Fix an issue where the pkcs11-tool was invoked with an empty mechanism
> due to a space after `-m ` flag. This caused signing to fail with the
> error "Unknown PKCS11 mechanism".
> 
> So, remove space after `-m` to fix PKCS#11 mechanism error as below.
>    ['-m ', 'SHA256-RSA-PKCS']
>    ['-m', 'SHA256-RSA-PKCS']
> 
> The mechanism should now correctly set to `SHA256-RSA-PKCS`.
> 
> Signed-off-by: Pratik Manvar <pratik.manvar@ifm.com>
> ---
>   swugenerator/swu_sign.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/swugenerator/swu_sign.py b/swugenerator/swu_sign.py
> index 437a0a5..53b6727 100644
> --- a/swugenerator/swu_sign.py
> +++ b/swugenerator/swu_sign.py
> @@ -129,7 +129,7 @@ class SWUSignPKCS11(SWUSign):
>           self.signcmd = [
>               "pkcs11-tool",
>               "-s",
> -            "-m ",
> +            "-m",
>               "SHA256-RSA-PKCS",
>               "-i",
>               sw_desc_in,

Sure, applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/swugenerator/swu_sign.py b/swugenerator/swu_sign.py
index 437a0a5..53b6727 100644
--- a/swugenerator/swu_sign.py
+++ b/swugenerator/swu_sign.py
@@ -129,7 +129,7 @@  class SWUSignPKCS11(SWUSign):
         self.signcmd = [
             "pkcs11-tool",
             "-s",
-            "-m ",
+            "-m",
             "SHA256-RSA-PKCS",
             "-i",
             sw_desc_in,