internal static extern void OcspResponseDestroy(IntPtr ocspReq);
[DllImport(Libraries.CryptoNative)]
- private static extern X509VerifyStatusCode CryptoNative_X509ChainGetCachedOcspStatus(
+ private static extern int CryptoNative_X509ChainGetCachedOcspStatus(
SafeX509StoreCtxHandle ctx,
string cachePath,
int chainDepth);
internal static X509VerifyStatusCode X509ChainGetCachedOcspStatus(SafeX509StoreCtxHandle ctx, string cachePath, int chainDepth)
{
- X509VerifyStatusCode response = CryptoNative_X509ChainGetCachedOcspStatus(ctx, cachePath, chainDepth);
+ X509VerifyStatusCode response = (X509VerifyStatusCode)CryptoNative_X509ChainGetCachedOcspStatus(ctx, cachePath, chainDepth);
if (response.Code < 0)
{
}
[DllImport(Libraries.CryptoNative)]
- private static extern X509VerifyStatusCode CryptoNative_X509ChainVerifyOcsp(
+ private static extern int CryptoNative_X509ChainVerifyOcsp(
SafeX509StoreCtxHandle ctx,
SafeOcspRequestHandle req,
SafeOcspResponseHandle resp,
string cachePath,
int chainDepth)
{
- X509VerifyStatusCode response = CryptoNative_X509ChainVerifyOcsp(ctx, req, resp, cachePath, chainDepth);
+ X509VerifyStatusCode response = (X509VerifyStatusCode)CryptoNative_X509ChainVerifyOcsp(ctx, req, resp, cachePath, chainDepth);
if (response.Code < 0)
{
return result != 0;
}
- [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_X509StoreCtxGetError")]
- internal static extern X509VerifyStatusCode X509StoreCtxGetError(SafeX509StoreCtxHandle ctx);
+ [DllImport(Libraries.CryptoNative)]
+ internal static extern int CryptoNative_X509StoreCtxGetError(SafeX509StoreCtxHandle ctx);
+
+ internal static X509VerifyStatusCode X509StoreCtxGetError(SafeX509StoreCtxHandle ctx)
+ {
+ return (X509VerifyStatusCode)CryptoNative_X509StoreCtxGetError(ctx);
+ }
[DllImport(Libraries.CryptoNative)]
private static extern int CryptoNative_X509StoreCtxReset(SafeX509StoreCtxHandle ctx);
return NULL;
}
-X509VerifyStatusCode CryptoNative_X509StoreCtxGetError(X509_STORE_CTX* ctx)
+int32_t CryptoNative_X509StoreCtxGetError(X509_STORE_CTX* ctx)
{
- return (unsigned int)X509_STORE_CTX_get_error(ctx);
+ return (int32_t)X509_STORE_CTX_get_error(ctx);
}
int32_t CryptoNative_X509StoreCtxReset(X509_STORE_CTX* ctx)
return X509_STORE_CTX_get_error_depth(ctx);
}
-const char* CryptoNative_X509VerifyCertErrorString(X509VerifyStatusCode n)
+const char* CryptoNative_X509VerifyCertErrorString(int32_t n)
{
return X509_verify_cert_error_string((long)n);
}
return t;
}
-X509VerifyStatusCode CryptoNative_X509ChainGetCachedOcspStatus(X509_STORE_CTX* storeCtx, char* cachePath, int chainDepth)
+int32_t CryptoNative_X509ChainGetCachedOcspStatus(X509_STORE_CTX* storeCtx, char* cachePath, int chainDepth)
{
if (storeCtx == NULL || cachePath == NULL)
{
- return (X509VerifyStatusCode)-1;
+ return -1;
}
X509* subject;
if (!Get0CertAndIssuer(storeCtx, chainDepth, &subject, &issuer))
{
- return (X509VerifyStatusCode)-2;
+ return -2;
}
X509VerifyStatusCode ret = PAL_X509_V_ERR_UNABLE_TO_GET_CRL;
if (fullPath == NULL)
{
- return ret;
+ return (int32_t)ret;
}
BIO* bio = BIO_new_file(fullPath, "rb");
OCSP_RESPONSE_free(resp);
}
- return ret;
+ return (int32_t)ret;
}
OCSP_REQUEST* CryptoNative_X509ChainBuildOcspRequest(X509_STORE_CTX* storeCtx, int chainDepth)
return req;
}
-X509VerifyStatusCode
+int32_t
CryptoNative_X509ChainVerifyOcsp(X509_STORE_CTX* storeCtx, OCSP_REQUEST* req, OCSP_RESPONSE* resp, char* cachePath, int chainDepth)
{
if (storeCtx == NULL || req == NULL || resp == NULL)
{
- return (X509VerifyStatusCode)-1;
+ return -1;
}
X509* subject;
if (!Get0CertAndIssuer(storeCtx, chainDepth, &subject, &issuer))
{
- return (X509VerifyStatusCode)-2;
+ return -2;
}
X509VerifyStatusCode ret = PAL_X509_V_ERR_UNABLE_TO_GET_CRL;
if (certId == NULL)
{
- return (X509VerifyStatusCode)-3;
+ return -3;
}
ASN1_GENERALIZEDTIME* thisUpdate = NULL;
ASN1_GENERALIZEDTIME_free(thisUpdate);
}
- return ret;
+ return (int32_t)ret;
}
/*
Shims the X509_STORE_CTX_get_error method.
*/
-PALEXPORT X509VerifyStatusCode CryptoNative_X509StoreCtxGetError(X509_STORE_CTX* ctx);
+PALEXPORT int32_t CryptoNative_X509StoreCtxGetError(X509_STORE_CTX* ctx);
/*
Resets ctx to before the chain was built, preserving the target cert, trust store, extra cert context,
/*
Shims the X509_verify_cert_error_string method.
*/
-PALEXPORT const char* CryptoNative_X509VerifyCertErrorString(X509VerifyStatusCode n);
+PALEXPORT const char* CryptoNative_X509VerifyCertErrorString(int32_t n);
/*
Shims the X509_CRL_free method.
Look for a cached OCSP response appropriate to the end-entity certificate using the issuer as
determined by the chain in storeCtx.
*/
-PALEXPORT X509VerifyStatusCode CryptoNative_X509ChainGetCachedOcspStatus(X509_STORE_CTX* storeCtx, char* cachePath, int chainDepth);
+PALEXPORT int32_t CryptoNative_X509ChainGetCachedOcspStatus(X509_STORE_CTX* storeCtx, char* cachePath, int chainDepth);
/*
Build an OCSP request appropriate for the end-entity certificate using the issuer (and trust) as
Determine if the OCSP response is acceptable, and if acceptable report the status and
cache the result (if appropriate)
*/
-PALEXPORT X509VerifyStatusCode CryptoNative_X509ChainVerifyOcsp(X509_STORE_CTX* storeCtx,
- OCSP_REQUEST* req,
- OCSP_RESPONSE* resp,
- char* cachePath,
- int chainDepth);
+PALEXPORT int32_t CryptoNative_X509ChainVerifyOcsp(X509_STORE_CTX* storeCtx,
+ OCSP_REQUEST* req,
+ OCSP_RESPONSE* resp,
+ char* cachePath,
+ int chainDepth);