minor modification

This commit is contained in:
cool 2011-08-25 16:32:24 -11:00
parent 5842a1631f
commit 8175c1106b
2 changed files with 1 additions and 32 deletions

View File

@ -641,33 +641,3 @@ void credssp_free(rdpCredssp* credssp)
xfree(credssp);
}
}
char* crypto_cert_fingerprint(X509 *xcert)
{
unsigned char fp[EVP_MAX_MD_SIZE];
int i;
unsigned int fp_len;
X509_digest(xcert,EVP_sha1(),fp,&fp_len);
char *fp_buf=xzalloc(3*fp_len);
char *p = fp_buf;
for (i = 0; i < fp_len - 1; i++)
{
sprintf(p, "%02x:", fp[i]);
p = (char*) &fp_buf[i * 3];
}
sprintf(p, "%02x", fp[i]);
return fp_buf;
}
void crypto_cert_printinfo(X509 *xcert)
{
char *subject;
char *issuer;
char *fp;
subject=X509_NAME_oneline(X509_get_subject_name(xcert),NULL,0);
issuer=X509_NAME_oneline(X509_get_issuer_name(xcert),NULL,0);
fp=crypto_cert_fingerprint(xcert);
printf("Cerificate details:\n");
printf("\tSubject : %s\n",subject);
printf("\tIssuer : %s\n",issuer);
printf("\tCert Thumbprint (sha1) : %s\n",fp);
xfree(fp);
}

View File

@ -265,7 +265,7 @@ boolean tls_verify_cert(CryptoCert cert)
if (lookup == NULL)
goto end;
X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
X509_LOOKUP_add_dir(lookup,"/home/whoami/project/install",X509_FILETYPE_ASN1);
X509_LOOKUP_add_dir(lookup,CA_LOCAL_PATH,X509_FILETYPE_ASN1);
csc = X509_STORE_CTX_new();
if (csc == NULL)
goto end;
@ -273,7 +273,6 @@ boolean tls_verify_cert(CryptoCert cert)
if(!X509_STORE_CTX_init(csc,cert_ctx,xcert,0))
goto end;
int i=X509_verify_cert(csc);
int cert_error=X509_STORE_CTX_get_error(cert_ctx);
X509_STORE_CTX_free(csc);
X509_STORE_free(cert_ctx);
ret=0;