Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2019-02-19_fix-pss-saltlen #65

Merged
merged 2 commits into from
Jan 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/jose/jwa.ex
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ defmodule JOSE.JWA do
## Options

* `:rsa_padding` - one of `:rsa_pkcs1_pss_padding` or `:rsa_pkcs1_padding`
* `:rsa_pss_saltlen` - sets the salt length for `:rsa_pkcs1_pss_padding`, defaults to `-2`
* `:rsa_pss_saltlen` - sets the salt length for `:rsa_pkcs1_pss_padding`, defaults to `-1`
* `-2` - use maximum for salt length
* `-1` - use hash length for salt length
* any number higher than `-1` is used as the actual salt length
Expand All @@ -115,7 +115,7 @@ defmodule JOSE.JWA do

* `:rsa_padding` - one of `:rsa_pkcs1_pss_padding` or `:rsa_pkcs1_padding`
* `:rsa_pss_saltlen` - sets the salt length for `:rsa_pkcs1_pss_padding`, defaults to `-2`
* `-2` - use maximum for salt length
* `-2` - automatically determine based on the PSS block structure
* `-1` - use hash length for salt length
* any number higher than `-1` is used as the actual salt length
"""
Expand Down
2 changes: 1 addition & 1 deletion src/jose_jwa_pkcs1.erl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ sign(Message, DigestType, RSAPrivateKey=#'RSAPrivateKey'{}, Options)
when is_list(Options) ->
Res = case proplists:get_value(rsa_padding, Options) of
rsa_pkcs1_pss_padding ->
SaltLen = proplists:get_value(rsa_pss_saltlen, Options, -2),
SaltLen = proplists:get_value(rsa_pss_saltlen, Options, -1),
rsassa_pss_sign(DigestType, Message, SaltLen, RSAPrivateKey);
rsa_pkcs1_padding ->
rsassa_pkcs1_sign(DigestType, Message, RSAPrivateKey);
Expand Down