Forráskód Böngészése

Asymetric decrypt func of Basic128Rsa15 did not set rsa padding

The function asym_decrypt_sp_basic128rsa15() did not set any rsa
padding. If some other assymentric function of the security policy
was executed, setting a different padding, it made the decrypt
function to not work anymore.
The RSA padding is now set to PKCS-1 v.1.5 with hash ID 0. It equals
the padding the encrypt function of the security policy sets.
Jonas Green 5 éve
szülő
commit
e983426492
1 módosított fájl, 1 hozzáadás és 0 törlés
  1. 1 0
      plugins/ua_securitypolicy_basic128rsa15.c

+ 1 - 0
plugins/ua_securitypolicy_basic128rsa15.c

@@ -219,6 +219,7 @@ asym_decrypt_sp_basic128rsa15(const UA_SecurityPolicy *securityPolicy,
 
     mbedtls_rsa_context *rsaContext =
         mbedtls_pk_rsa(cc->policyContext->localPrivateKey);
+    mbedtls_rsa_set_padding(rsaContext, MBEDTLS_RSA_PKCS_V15, 0);
 
     if(data->length % rsaContext->len != 0)
         return UA_STATUSCODE_BADINTERNALERROR;