1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-03-25 01:44:50 +00:00
UTPass/plugins/Pass/error.h

31 lines
570 B
C

// error.h
#ifndef ERROR_H
#define ERROR_H
extern "C" {
#include "rnp/rnp_err.h"
}
enum ErrorCodeShow {
UnexceptedError= 1,
BadPassphrase,
NoKeyFound,
DecryptFailed
};
ErrorCodeShow rnpErrorToErrorCodeShow(int rnpErrorCode) {
switch (rnpErrorCode) {
case RNP_ERROR_BAD_PASSWORD:
return BadPassphrase;
case RNP_ERROR_KEY_NOT_FOUND:
case RNP_ERROR_NO_SUITABLE_KEY:
return NoKeyFound;
case RNP_ERROR_DECRYPT_FAILED:
return DecryptFailed;
default:
return UnexceptedError;
}
}
#endif // ERROR_H