8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:03:03 +01:00

Resolve #6806, fixed related examples in readme

This commit is contained in:
AlexPeshkoff 2021-05-12 19:32:49 +03:00
parent ddf9c92f6b
commit cc443cce20
5 changed files with 22 additions and 22 deletions

View File

@ -1101,15 +1101,15 @@ Example:
key rdb$get_context('USER_SESSION', 'private_key')) from rdb$database;
--------
RSA_SIGN
--------
-------------
RSA_SIGN_HASH
-------------
Function:
Performs PSS encoding of message digest to be signed and signs using RSA private key.
Format:
RSA_SIGN ( <string> KEY <private key> [HASH <hash>] [SALT_LENGTH <smallint>] )
RSA_SIGN_HASH ( <string> KEY <private key> [HASH <hash>] [SALT_LENGTH <smallint>] )
KEY should be a value, returhed by RSA_PRIVATE function.
hash ::= { MD5 | SHA1 | SHA256 | SHA512 } Default is SHA256.
SALT_LENGTH indicates the length of the desired salt, and should typically be small.
@ -1117,20 +1117,20 @@ Format:
Example:
(tip - start running samples one by one from RSA_PRIVATE function)
select rdb$set_context('USER_SESSION', 'msg', rsa_sign(hash('Test message' using sha256)
select rdb$set_context('USER_SESSION', 'msg', rsa_sign_hash(crypt_hash('Test message' using sha256)
key rdb$get_context('USER_SESSION', 'private_key'))) from rdb$database;
----------
RSA_VERIFY
----------
---------------
RSA_VERIFY_HASH
---------------
Function:
Performs PSS encoding of message digest to be signed and verifies it's digital signature
using RSA public key.
Format:
RSA_VERIFY ( <string> SIGNATURE <string> KEY <public key> [HASH <hash>] [SALT_LENGTH <smallint>] )
RSA_VERIFY_HASH ( <string> SIGNATURE <string> KEY <public key> [HASH <hash>] [SALT_LENGTH <smallint>] )
SIGNATURE should be a value, returhed by RSA_SIGN function.
KEY should be a value, returhed by RSA_PUBLIC function.
hash ::= { MD5 | SHA1 | SHA256 | SHA512 } Default is SHA256.
@ -1139,7 +1139,7 @@ Format:
Example:
(tip - start running samples one by one from RSA_PRIVATE function)
select rsa_verify(hash('Test message' using sha256) signature rdb$get_context('USER_SESSION', 'msg')
select rsa_verify_hash(crypt_hash('Test message' using sha256) signature rdb$get_context('USER_SESSION', 'msg')
key rdb$get_context('USER_SESSION', 'public_key')) from rdb$database;

View File

@ -363,8 +363,8 @@ Firebird 4.0
RSA_ENCRYPT *
RSA_PRIVATE *
RSA_PUBLIC *
RSA_SIGN *
RSA_VERIFY *
RSA_SIGN_HASH *
RSA_VERIFY_HASH *
SALT_LENGTH *
SECURITY
SESSION

View File

@ -431,8 +431,8 @@ static const TOK tokens[] =
{TOK_RSA_ENCRYPT, "RSA_ENCRYPT", true},
{TOK_RSA_PRIVATE, "RSA_PRIVATE", true},
{TOK_RSA_PUBLIC, "RSA_PUBLIC", true},
{TOK_RSA_SIGN, "RSA_SIGN", true},
{TOK_RSA_VERIFY, "RSA_VERIFY", true},
{TOK_RSA_SIGN_HASH, "RSA_SIGN_HASH", true},
{TOK_RSA_VERIFY_HASH, "RSA_VERIFY_HASH", true},
{TOK_SALT_LENGTH, "SALT_LENGTH", true},
{TOK_SAVEPOINT, "SAVEPOINT", false},
{TOK_SCALAR_ARRAY, "SCALAR_ARRAY", true},

View File

@ -651,8 +651,8 @@ using namespace Firebird;
%token <metaNamePtr> RSA_ENCRYPT
%token <metaNamePtr> RSA_PRIVATE
%token <metaNamePtr> RSA_PUBLIC
%token <metaNamePtr> RSA_SIGN
%token <metaNamePtr> RSA_VERIFY
%token <metaNamePtr> RSA_SIGN_HASH
%token <metaNamePtr> RSA_VERIFY_HASH
%token <metaNamePtr> SALT_LENGTH
%token <metaNamePtr> SECURITY
%token <metaNamePtr> SESSION
@ -8221,14 +8221,14 @@ system_function_special_syntax
add(MAKE_str_constant(newIntlString($7->c_str()), CS_ASCII)));
$$->dsqlSpecialSyntax = true;
}
| RSA_SIGN '(' value KEY value crypt_opt_hash crypt_opt_saltlen ')'
| RSA_SIGN_HASH '(' value KEY value crypt_opt_hash crypt_opt_saltlen ')'
{
$$ = newNode<SysFuncCallNode>(*$1,
newNode<ValueListNode>($3)->add($5)->
add(MAKE_str_constant(newIntlString($6->c_str()), CS_ASCII))->add($7));
$$->dsqlSpecialSyntax = true;
}
| RSA_VERIFY'(' value SIGNATURE value KEY value crypt_opt_hash crypt_opt_saltlen ')'
| RSA_VERIFY_HASH '(' value SIGNATURE value KEY value crypt_opt_hash crypt_opt_saltlen ')'
{
$$ = newNode<SysFuncCallNode>(*$1,
newNode<ValueListNode>($3)->add($5)->add($7)->
@ -9028,8 +9028,8 @@ non_reserved_word
| RSA_ENCRYPT
| RSA_PRIVATE
| RSA_PUBLIC
| RSA_SIGN
| RSA_VERIFY
| RSA_SIGN_HASH
| RSA_VERIFY_HASH
| SALT_LENGTH
| SECURITY
| SESSION

View File

@ -6430,8 +6430,8 @@ const SysFunction SysFunction::functions[] =
{"RSA_ENCRYPT", 4, 4, setParamsRsaEncrypt, makeRsaEncrypt, evlRsaEncrypt, NULL},
{"RSA_PRIVATE", 1, 1, setParamsInteger, makeRsaPrivate, evlRsaPrivate, NULL},
{"RSA_PUBLIC", 1, 1, setParamsRsaPublic, makeRsaPublic, evlRsaPublic, NULL},
{"RSA_SIGN", 4, 4, setParamsRsaSign, makeRsaSign, evlRsaSign, NULL},
{"RSA_VERIFY", 5, 5, setParamsRsaVerify, makeBoolResult, evlRsaVerify, NULL},
{"RSA_SIGN_HASH", 4, 4, setParamsRsaSign, makeRsaSign, evlRsaSign, NULL},
{"RSA_VERIFY_HASH", 5, 5, setParamsRsaVerify, makeBoolResult, evlRsaVerify, NULL},
{"SIGN", 1, 1, setParamsDblDec, makeShortResult, evlSign, NULL},
{"SIN", 1, 1, setParamsDouble, makeDoubleResult, evlStdMath, (void*) trfSin},
{"SINH", 1, 1, setParamsDouble, makeDoubleResult, evlStdMath, (void*) trfSinh},