diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2013-12-22 17:12:28 +0400 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2014-03-04 11:00:12 +0100 |
commit | ea8d597726305274214224757b32730644e12bd8 (patch) | |
tree | e416eb64049683d4f54353d30a8649995c28dab1 /cipher/pubkey-internal.h | |
parent | 6be3032048ee2466511d2384fcf2d28b856219b2 (diff) | |
download | libgcrypt-ea8d597726305274214224757b32730644e12bd8.tar.gz |
Add a simple (raw) PKCS#1 padding mode
* src/cipher.h (PUBKEY_ENC_PKCS1_RAW): New.
* cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist): Handle pkcs1-raw
flag.
* cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi):
Handle s-exp like (data (flags pkcs1-raw) (value xxxxx))
* cipher/rsa-common.c (_gcry_rsa_pkcs1_encode_raw_for_sig):
PKCS#1-encode data with embedded hash OID for signature verification.
* tests/basic.c (check_pubkey_sign): Add tests for s-exps with pkcs1-raw
flag.
--
Allow user to specify (flags pkcs1-raw) to enable pkcs1 padding of raw
value (no hash algorithm is specified). It is up to the user to verify
that the passed value is properly formatted and includes DER-encoded
ASN OID of the used hash function.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Diffstat (limited to 'cipher/pubkey-internal.h')
-rw-r--r-- | cipher/pubkey-internal.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cipher/pubkey-internal.h b/cipher/pubkey-internal.h index 193248c3..b8167c77 100644 --- a/cipher/pubkey-internal.h +++ b/cipher/pubkey-internal.h @@ -56,6 +56,10 @@ gpg_err_code_t _gcry_rsa_pkcs1_decode_for_enc (unsigned char **r_result, size_t *r_resultlen, unsigned int nbits, gcry_mpi_t value); gpg_err_code_t +_gcry_rsa_pkcs1_encode_raw_for_sig (gcry_mpi_t *r_result, unsigned int nbits, + const unsigned char *value, size_t valuelen); + +gpg_err_code_t _gcry_rsa_pkcs1_encode_for_sig (gcry_mpi_t *r_result, unsigned int nbits, const unsigned char *value, size_t valuelen, int algo); |