예제 #1
0
int rsaVerify(const unsigned char *inBuf, size_t inLen, unsigned char *outBuf, const char *keyfile)
{
	RSA *rsa = NULL;
	int keysize, ret = 0;
	int old_fmode = _fmode;
	apps_startup();
	app_RAND_load_file(NULL, bio_err, 0);

	rsa = loadPublicKey(keyfile);
	if(!rsa)
	{
		BIO_printf(bio_err, "Error getting RSA key\n");
		ERR_print_errors(bio_err);
		goto sign_err;
	}
	keysize = RSA_size(rsa);
	ret = RSA_public_decrypt(inLen, inBuf, outBuf, rsa, RSA_PKCS1_PADDING);
	if(ret <= 0)
	{
		BIO_printf(bio_err, "RSA operation error\n");
		ERR_print_errors(bio_err);
		goto sign_err;
	}
sign_err:
	if (rsa) RSA_free(rsa);
	apps_shutdown(old_fmode);
	return ret;
}
void WalletSerializerV1::loadKeys(Common::IInputStream& source, CryptoContext& cryptoContext) {
  try {
    loadPublicKey(source, cryptoContext);
    loadSecretKey(source, cryptoContext);
  } catch (const std::runtime_error&) {
    throw std::system_error(make_error_code(CryptoNote::error::WRONG_PASSWORD));
  }
}
예제 #3
0
void WalletSerializer::loadKeys(Common::IInputStream& source, CryptoContext& cryptoContext) {
  loadPublicKey(source, cryptoContext);
  loadSecretKey(source, cryptoContext);
}