diff options
Diffstat (limited to 'src/libstrongswan/credentials/keys/public_key.c')
-rw-r--r-- | src/libstrongswan/credentials/keys/public_key.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libstrongswan/credentials/keys/public_key.c b/src/libstrongswan/credentials/keys/public_key.c index a5f547038..4abaf4010 100644 --- a/src/libstrongswan/credentials/keys/public_key.c +++ b/src/libstrongswan/credentials/keys/public_key.c @@ -39,6 +39,30 @@ ENUM(signature_scheme_names, SIGN_UNKNOWN, SIGN_ECDSA_521, "ECDSA-521", ); +/** + * See header. + */ +bool public_key_equals(public_key_t *this, public_key_t *other) +{ + key_encoding_type_t type; + chunk_t a, b; + + if (this == other) + { + return TRUE; + } + + for (type = 0; type < KEY_ENCODING_MAX; type++) + { + if (this->get_fingerprint(this, type, &a) && + other->get_fingerprint(other, type, &b)) + { + return chunk_equals(a, b); + } + } + return FALSE; +} + /* * Defined in header. */ |