summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/x509/x509_ac.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/plugins/x509/x509_ac.c')
-rw-r--r--src/libstrongswan/plugins/x509/x509_ac.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/src/libstrongswan/plugins/x509/x509_ac.c b/src/libstrongswan/plugins/x509/x509_ac.c
index 2168f9bc7..638f96b44 100644
--- a/src/libstrongswan/plugins/x509/x509_ac.c
+++ b/src/libstrongswan/plugins/x509/x509_ac.c
@@ -14,8 +14,6 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
- *
- * $Id$
*/
#include "x509_ac.h"
@@ -32,6 +30,7 @@
#include <utils/identification.h>
#include <utils/linked_list.h>
#include <credentials/certificates/x509.h>
+#include <credentials/keys/private_key.h>
extern identification_t* x509_parse_authorityKeyIdentifier(chunk_t blob,
int level0, chunk_t *authKeySerialNumber);
@@ -780,31 +779,11 @@ static bool issued_by(private_x509_ac_t *this, certificate_t *issuer)
return FALSE;
}
}
- /* TODO: generic OID to scheme mapper? */
- switch (this->algorithm)
- {
- case OID_MD5_WITH_RSA:
- scheme = SIGN_RSA_EMSA_PKCS1_MD5;
- break;
- case OID_SHA1_WITH_RSA:
- scheme = SIGN_RSA_EMSA_PKCS1_SHA1;
- break;
- case OID_SHA256_WITH_RSA:
- scheme = SIGN_RSA_EMSA_PKCS1_SHA256;
- break;
- case OID_SHA384_WITH_RSA:
- scheme = SIGN_RSA_EMSA_PKCS1_SHA384;
- break;
- case OID_SHA512_WITH_RSA:
- scheme = SIGN_RSA_EMSA_PKCS1_SHA512;
- break;
- case OID_ECDSA_WITH_SHA1:
- scheme = SIGN_ECDSA_WITH_SHA1;
- break;
- default:
- return FALSE;
- }
- if (key == NULL)
+
+ /* determine signature scheme */
+ scheme = signature_scheme_from_oid(this->algorithm);
+
+ if (scheme == SIGN_UNKNOWN || key == NULL)
{
return FALSE;
}