aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2010-08-10 14:38:44 +0200
committerMartin Willi <martin@revosec.ch>2010-08-10 18:46:30 +0200
commit33ddaaabec136e358bf38a6aeb7855f466603007 (patch)
tree859a922eddbf0810e7e8917afdbde1a7a8de22b7 /src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
parent3547a9b87de314d31f88adb8a0098a885cdf7c5d (diff)
downloadstrongswan-33ddaaabec136e358bf38a6aeb7855f466603007.tar.bz2
strongswan-33ddaaabec136e358bf38a6aeb7855f466603007.tar.xz
Added support for different encryption schemes to private/public keys
Diffstat (limited to 'src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c')
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
index 4e557c743..7eae5949d 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
@@ -193,11 +193,18 @@ METHOD(public_key_t, verify, bool,
}
METHOD(public_key_t, encrypt_, bool,
- private_gcrypt_rsa_public_key_t *this, chunk_t plain, chunk_t *encrypted)
+ private_gcrypt_rsa_public_key_t *this, encryption_scheme_t scheme,
+ chunk_t plain, chunk_t *encrypted)
{
gcry_sexp_t in, out;
gcry_error_t err;
+ if (scheme != ENCRYPT_RSA_PKCS1)
+ {
+ DBG1(DBG_LIB, "encryption scheme %N not supported",
+ encryption_scheme_names, scheme);
+ return FALSE;
+ }
/* "pkcs1" uses PKCS 1.5 (section 8.1) block type 2 encryption:
* 00 | 02 | RANDOM | 00 | DATA */
err = gcry_sexp_build(&in, NULL, "(data(flags pkcs1)(value %b))",