aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2017-10-27 15:09:46 +0200
committerTobias Brunner <tobias@strongswan.org>2017-11-08 16:48:10 +0100
commit364395d2de6ac15aefa43d05855d1dff244b38de (patch)
treed577bfb87d1816d6d25632fc302367639b1ad2ea
parentfb63012e0cad81aa7a4289be6d6f1fea8bd2811f (diff)
downloadstrongswan-364395d2de6ac15aefa43d05855d1dff244b38de.tar.bz2
strongswan-364395d2de6ac15aefa43d05855d1dff244b38de.tar.xz
Treat RSASSA-PSS keys like rsaEncryption RSA keys
In theory we should treat any parameters and the identifier itself as restriction to only use the key to create signatures accordingly (e.g. only use RSA with PSS padding or even use specific hash algorithms). But that's currently tricky as we'd have to store and pass this information along with our private keys (i.e. use PKCS#8 to store them and change the builder calls to pass along the identifier and parameters). That would require quite some work.
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_x509.c4
-rw-r--r--src/libstrongswan/plugins/pkcs1/pkcs1_builder.c7
-rw-r--r--src/libstrongswan/plugins/pkcs8/pkcs8_builder.c10
3 files changed, 20 insertions, 1 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_x509.c b/src/libstrongswan/plugins/openssl/openssl_x509.c
index e4932c2a1..60c08770b 100644
--- a/src/libstrongswan/plugins/openssl/openssl_x509.c
+++ b/src/libstrongswan/plugins/openssl/openssl_x509.c
@@ -1090,6 +1090,10 @@ static bool parse_certificate(private_openssl_x509_t *this)
}
switch (openssl_asn1_known_oid(oid))
{
+ case OID_RSASSA_PSS:
+ /* TODO: we should treat such keys special and use the params as
+ * restrictions regarding the use of this key (or rather the
+ * associated private key) */
case OID_RSA_ENCRYPTION:
this->pubkey = lib->creds->create(lib->creds,
CRED_PUBLIC_KEY, KEY_RSA, BUILD_BLOB_ASN1_DER,
diff --git a/src/libstrongswan/plugins/pkcs1/pkcs1_builder.c b/src/libstrongswan/plugins/pkcs1/pkcs1_builder.c
index f64294783..967e501d1 100644
--- a/src/libstrongswan/plugins/pkcs1/pkcs1_builder.c
+++ b/src/libstrongswan/plugins/pkcs1/pkcs1_builder.c
@@ -57,8 +57,13 @@ static public_key_t *parse_public_key(chunk_t blob)
int oid = asn1_parse_algorithmIdentifier(object,
parser->get_level(parser)+1, NULL);
- if (oid == OID_RSA_ENCRYPTION || oid == OID_RSAES_OAEP)
+ if (oid == OID_RSA_ENCRYPTION || oid == OID_RSAES_OAEP ||
+ oid == OID_RSASSA_PSS)
{
+ /* TODO: we should parse parameters for PSS and pass them
+ * (and the type), or the complete subjectPublicKeyInfo,
+ * along so we can treat these as restrictions when
+ * generating signatures with the associated private key */
type = KEY_RSA;
}
else if (oid == OID_EC_PUBLICKEY)
diff --git a/src/libstrongswan/plugins/pkcs8/pkcs8_builder.c b/src/libstrongswan/plugins/pkcs8/pkcs8_builder.c
index beb8866f8..9c1c03dfe 100644
--- a/src/libstrongswan/plugins/pkcs8/pkcs8_builder.c
+++ b/src/libstrongswan/plugins/pkcs8/pkcs8_builder.c
@@ -63,6 +63,16 @@ static private_key_t *parse_private_key(chunk_t blob)
switch (oid)
{
+ case OID_RSASSA_PSS:
+ /* TODO: parameters associated with such keys should be
+ * treated as restrictions later when signing (the type
+ * itself is already a restriction). However, the
+ * builders currently don't expect any parameters for
+ * RSA keys (we also only pass along the params, not the
+ * exact type, so we'd have to guess that params
+ * indicate RSA/PSS, but they are optional so that won't
+ * work for keys without specific restrictions) */
+ params = chunk_empty;
case OID_RSA_ENCRYPTION:
type = KEY_RSA;
break;