jeroen / openssl

OpenSSL bindings for R
Other
63 stars 22 forks source link

Default to SHA-256 hashes for public key fingerprints #93

Closed atheriel closed 2 years ago

atheriel commented 2 years ago

Currently public keys cannot be generated on FIPS-compliant systems because these systems do not permit use of the MD5 algorithm:

> k <- openssl::rsa_keygen(2048)
> pub <- k$pubkey
Error: OpenSSL error in EVP_DigestInit_ex: disabled for fips

Given the existing API there's no easy way to pass through the hash function you want, so this commit does the easiest thing and just changes the fingerprint to use SHA-256, which will work on FIPS-compliant systems.

Worth mentioning is that recent versions of OpenSSL's command-line tools have also switched to SHA-256 by default, so this is not an unreasonable move.

Related unit tests have also been updated.

Side note: this originally surfaced in rstudio/rsconnect#452.

atheriel commented 2 years ago

@jeroen indicated to me privately that he was uncomfortable making a breaking change of this kind, so I have opened #95 with a different approach instead.

jeroen commented 2 years ago

This has landed in openssl 2.0.0 on CRAN now.