mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
add error function and print out
This commit is contained in:
@ -149,6 +149,7 @@ class wolfSSL_Example_IOCallbacks
|
||||
}
|
||||
|
||||
Console.WriteLine("Status of certificate verify = " + preverify);
|
||||
Console.WriteLine("Error value for cert store is " + wolfssl.X509_STORE_CTX_get_error(store));
|
||||
|
||||
/* look at the current cert in store */
|
||||
try
|
||||
@ -171,7 +172,7 @@ class wolfSSL_Example_IOCallbacks
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Unable to get X509's");
|
||||
Console.WriteLine("Unable to get X509's" + e);
|
||||
}
|
||||
|
||||
/* list all certs in store */
|
||||
@ -190,11 +191,11 @@ class wolfSSL_Example_IOCallbacks
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Unable to get X509's");
|
||||
Console.WriteLine("Unable to get X509's" + e);
|
||||
}
|
||||
|
||||
/* by returning 1 here we override any failure and report success */
|
||||
return 1;
|
||||
return preverify;
|
||||
}
|
||||
|
||||
private static void clean(IntPtr ssl, IntPtr ctx)
|
||||
|
@ -339,6 +339,8 @@ namespace wolfSSL.CSharp {
|
||||
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private extern static IntPtr wolfSSL_X509_STORE_CTX_get_current_cert(IntPtr x509Ctx);
|
||||
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private extern static int wolfSSL_X509_STORE_CTX_get_error(IntPtr sk);
|
||||
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private extern static IntPtr wolfSSL_X509_STORE_GetCerts(IntPtr x509Ctx);
|
||||
[DllImport(wolfssl_dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
private extern static int wolfSSL_sk_X509_num(IntPtr sk);
|
||||
@ -1949,6 +1951,29 @@ namespace wolfSSL.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the current WOLFSSL_X509_STORE_CTX error value
|
||||
/// </summary>
|
||||
/// <param name="x509Ctx">pointer to store to get error from</param>
|
||||
public static int X509_STORE_CTX_get_error(IntPtr x509Ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (x509Ctx == IntPtr.Zero)
|
||||
{
|
||||
log(ERROR_LOG, "pointer passed in was not set");
|
||||
return -1;
|
||||
}
|
||||
return wolfSSL_X509_STORE_CTX_get_error(x509Ctx);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log(ERROR_LOG, "wolfssl WOLFSSL_X509_STORE_CTX error " + e.ToString());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print low level C library debug messages to stdout when compiled with macro DEBUG_WOLFSSL
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user