SUPPORT-8761. Подробное логирование ошибки об истекшей лицензии (+ о неправильном пароле)

This commit is contained in:
Наиля Алашкова 2024-12-02 12:02:24 +03:00
parent 2ae3112330
commit bc51d2a8cd
2 changed files with 32 additions and 1 deletions

View file

@ -5,6 +5,7 @@
#include "library.h"
#include "logger.h"
static capi_function_list_t cp_function_list;
static library_t libcapi;
@ -203,6 +204,28 @@ exit:
return is_verified;
}
static void
log_sign_hash_data_last_error()
{
DWORD error = cp_function_list.GetLastError();
switch (error) {
case ERROR_FUNCTION_FAILED:
LOG_ERROR("sign_hash_data exit with error. Last error code: "
"license is expired or not yet valid (0x%08x)", error);
break;
case SCARD_W_WRONG_CHV:
LOG_ERROR("sign_hash_data exit with error. Last error code: "
"the wrong PIN was presented (0x%08x)", error);
break;
default:
LOG_ERROR("sign_hash_data exit with error. Last error code: 0x%08x", error);
break;
}
}
static int
sign_hash_data(const cryptopro_context_t *ctx, const str_t *data, /*out*/ str_t *sign)
{
@ -288,8 +311,9 @@ exit:
}
if (rc) {
LOG_ERROR("sign_hash_data exit with error. Last error code: 0x%08x", cp_function_list.GetLastError());
log_sign_hash_data_last_error();
}
return rc;
}

View file

@ -225,6 +225,13 @@ curl -v http://127.0.0.1/version
В ответе будет получена версия приложения (статус-код ответа должен быть равен 200 OK).
### Лицензия КриптоПро
Команда для проверки лицензии КриптоПро:
``` bash
/opt/cprocsp/sbin/amd64/cpconfig -license -view
```
### Примечания