if (silc_pkcs_get_type(pubkey) != SILC_PKCS_SILC)
continue;
- pk = silc_pkcs_public_key_encode(pubkey, &pk_len);
+ pk = silc_pkcs_public_key_encode(NULL, pubkey, &pk_len);
if (!pk)
continue;
va_end(va);
}
+void static verify_message_signature_verified(SilcBool success,
+ void *context)
+{
+ *(SilcBool *)context = success;
+}
+
/* Try to verify a message using locally stored public key data */
int verify_message_signature(SilcClientEntry sender,
SilcUInt32 pk_datalen;
struct stat st;
int ret = SILC_MSG_SIGNED_VERIFIED, i;
+ SilcBool verified = FALSE;
/* get public key from the signature payload and compare it with the
one stored in the client entry */
}
/* the public key is now in pk, our "level of trust" in ret */
- if ((pk) && silc_message_signed_verify(message, pk,
- sha1hash) != SILC_AUTH_OK)
- ret = SILC_MSG_SIGNED_FAILED;
+ if (pk) {
+ silc_message_signed_verify(message, pk, sha1hash,
+ verify_message_signature_verified, &verified);
+ if (!verified)
+ ret = SILC_MSG_SIGNED_FAILED;
+ }
if (pk)
silc_pkcs_public_key_free(pk);
}
/* Encode public key */
- pk = silc_pkcs_public_key_encode(public_key, &pk_len);
+ pk = silc_pkcs_public_key_encode(NULL, public_key, &pk_len);
if (!pk) {
if (completion)
completion(FALSE, context);
}
/* Encode the key data */
- encpk = silc_pkcs_public_key_encode(local_pubkey, &encpk_len);
+ encpk = silc_pkcs_public_key_encode(NULL, local_pubkey, &encpk_len);
if (!encpk) {
printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
SILCTXT_PUBKEY_RECEIVED,verify->entity_name ?