Logo Search packages:      
Sourcecode: pam-pkcs11 version File versions  Download package

CERTVFY_EXTERN int verify_signature ( X509 *  x509,
unsigned char *  data,
int  data_length,
unsigned char *  signature,
int  signature_length 

Verify signature of provided data

x509 Certificate to be used
data Byte array of data to check
data_len Lenght of provided byte array
signature Byte array of signature to check
signature_length Length of signature byte array
1 on signature vfy sucess, 0 on vfy fail, -1 on process error

Definition at line 452 of file cert_vfy.c.

  int rv;
  EVP_PKEY *pubkey;
  EVP_MD_CTX md_ctx;

  /* get the public-key */
  pubkey = X509_get_pubkey(x509);
  if (pubkey == NULL) {
    set_error("X509_get_pubkey() failed: %s", ERR_error_string(ERR_get_error(), NULL));
    return -1;
  /* verify the signature */
  EVP_VerifyInit(&md_ctx, EVP_sha1());
  EVP_VerifyUpdate(&md_ctx, data, data_length);
  rv = EVP_VerifyFinal(&md_ctx, signature, signature_length, pubkey);
  if (rv != 1) {
    set_error("EVP_VerifyFinal() failed: %s", ERR_error_string(ERR_get_error(), NULL));
    return -1;
  DBG("signature is valid");
  return 0;

Generated by  Doxygen 1.6.0   Back to index