# openssl supported algorithms

- Thread: https://externals.io/message/46173
- Original archive: https://news-web.php.net/php.internals/46173
- Started by Rob Richards on 2009-11-24T17:27:22+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #46173 — Rob Richards — 2009-11-24T17:27:22+00:00

URL: https://externals.io/message/46173#46173

The openssl extension is way to restrictive in the algorithms it 
supports, i.e. no support for SHA265 which is starting to become the 
standard algo to use, etc.. Rather than having to always add more 
constants and additional logic for any new algorithms, I'd like to 
change the sign and verify functions to not only accept the current 
integers, but also a string so the EVP_get_digestbyname function can be 
used.

So while still supporting something list:
openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_SHA1)

It can also be called using:
openssl_sign($data, $signature, $priv_key_id, "SHA1")
openssl_sign($data, $signature, $priv_key_id, "SHA256")

Attached is a patch to illustrate the change made to the PHP_5_2 branch 
(only to the sign function but same change would be made to verify as well).
I'd really like to be able to support the string based algorithm rather 
than always having to add constants just for the added flexibility but 
in any case we really need to add support for more than what we have 
now. Personally I'd also like to see this in 5.2.12 but know that might 
be pushing it.

Rob

---

## #46174 — Rasmus Lerdorf — 2009-11-24T17:40:12+00:00

URL: https://externals.io/message/46173#46174 · In reply to: #46173

Seems like a no-brainer for 5.3 and trunk.  You will have to discuss
with Ilia for 5.2.  It seems a bit late in the game for that branch to
get this.

-Rasmus

Rob Richards wrote:
> The openssl extension is way to restrictive in the algorithms it
> supports, i.e. no support for SHA265 which is starting to become the
> standard algo to use, etc.. Rather than having to always add more
> constants and additional logic for any new algorithms, I'd like to
> change the sign and verify functions to not only accept the current
> integers, but also a string so the EVP_get_digestbyname function can be
> used.
> 
> So while still supporting something list:
> openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_SHA1)
> 
> It can also be called using:
> openssl_sign($data, $signature, $priv_key_id, "SHA1")
> openssl_sign($data, $signature, $priv_key_id, "SHA256")
> 
> Attached is a patch to illustrate the change made to the PHP_5_2 branch
> (only to the sign function but same change would be made to verify as
> well).
> I'd really like to be able to support the string based algorithm rather
> than always having to add constants just for the added flexibility but
> in any case we really need to add support for more than what we have
> now. Personally I'd also like to see this in 5.2.12 but know that might
> be pushing it.
> 
> Rob

---

## #46175 — Rob Richards — 2009-11-24T21:51:26+00:00

URL: https://externals.io/message/46173#46175 · In reply to: #46174

If I had only checked... Appears its been in trunk (and 5_3) for over 2 
years now :)

Rob

Rasmus Lerdorf wrote:
> Seems like a no-brainer for 5.3 and trunk.  You will have to discuss
> with Ilia for 5.2.  It seems a bit late in the game for that branch to
> get this.
>
> -Rasmus
>
> Rob Richards wrote:
>   
> > […]

---

## #46176 — Ilia Alshanetsky — 2009-11-24T22:01:14+00:00

URL: https://externals.io/message/46173#46176 · In reply to: #46175

Heh, I think given that we have 5.3 out there (with the code) there is little reason to introduce new features into a bug fix release which is 5.2.



> If I had only checked... Appears its been in trunk (and 5_3) for over 2 years now :)
> 
> Rob
> 
> Rasmus Lerdorf wrote:
> > […]
