I was doing research about a way to generate a digital signature of a file and found that there were at least two ways: openssl rsautl -sign
and openssl dgst -sign
.
I understand the difference between them at an algorithm level by reading Difference between openSSL rsautl and dgst
I am wondering if there is a difference between them at a security level . I suppose that the difference between them is the ASN1 encoding and that does not affect the strength of the security level of openssl rsautl -sign
. But if possible, I would like to make sure it.
I am planning to implement this in Ruby. It seems to me that openssl dgst -sign
can be implemented by using sign
in OpenSSL::PKey::RSA
and openssl rsautl -sign
can be implemented by using private_encrypt
in OpenSSL::PKey::RSA
.