Skip to content

Commit e754d12

Browse files
committed
FIX/CHANGE: using rsa/verify instead of rsa/validate
The naming taken from this post https://crypto.stackexchange.com/a/2124
1 parent 55031b7 commit e754d12

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/core/n-crypt.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ const REBYTE rsa_name[] = "RSA-context";
276276
// /encrypt "Use public key to encrypt data"
277277
// /decrypt "Use private key to decrypt data"
278278
// /sign "Use private key to sign data"
279-
// /validate "Use public key to validate signed data"
279+
// /verify "Use public key to verify signed data"
280280
// ]
281281
***********************************************************************/
282282
{
@@ -285,14 +285,14 @@ const REBYTE rsa_name[] = "RSA-context";
285285
REBOOL refEncrypt = D_REF(3);
286286
REBOOL refDecrypt = D_REF(4);
287287
REBOOL refSign = D_REF(5);
288-
REBOOL refValidate = D_REF(6);
288+
REBOOL refverify = D_REF(6);
289289

290290
// make sure that only one refinement is used!
291291
if(
292-
(refEncrypt && (refDecrypt || refSign || refValidate)) ||
293-
(refDecrypt && (refEncrypt || refSign || refValidate)) ||
294-
(refSign && (refDecrypt || refEncrypt || refValidate)) ||
295-
(refValidate && (refDecrypt || refSign || refEncrypt))
292+
(refEncrypt && (refDecrypt || refSign || refverify)) ||
293+
(refDecrypt && (refEncrypt || refSign || refverify)) ||
294+
(refSign && (refDecrypt || refEncrypt || refverify)) ||
295+
(refverify && (refDecrypt || refSign || refEncrypt))
296296
) {
297297
Trap0(RE_BAD_REFINES);
298298
}
@@ -337,7 +337,7 @@ const REBYTE rsa_name[] = "RSA-context";
337337
REBSER* output = Make_Binary(rsa_ctx->num_octets);
338338
REBYTE* outBinary = BIN_DATA(output);
339339

340-
if(refDecrypt || refValidate) {
340+
if(refDecrypt || refverify) {
341341
outBytes = RSA_decrypt(rsa_ctx, inBinary, outBinary, refDecrypt, FALSE);
342342
} else {
343343
outBytes = RSA_encrypt(rsa_ctx, inBinary, inBytes, outBinary, refSign, TRUE);

src/tests/units/rsa-test.r3

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ do %../quick-test.r3
8888
--assert binary? sign-hash: rsa/sign key-pri #{41686F6A21}
8989
--assert none? rsa/sign key-pub #{41686F6A21} ;because private key is needed
9090

91-
--test-- "RSA validation"
92-
;you can use both keys for validation (only the public parts are used)
93-
--assert #{41686F6A21} = rsa/validate key-pub sign-hash
94-
--assert #{41686F6A21} = rsa/validate key-pri sign-hash
91+
--test-- "RSA verifiation"
92+
;you can use both keys for verifiation (only the public parts are used)
93+
--assert #{41686F6A21} = rsa/verify key-pub sign-hash
94+
--assert #{41686F6A21} = rsa/verify key-pri sign-hash
9595

9696
===end-group===
9797

0 commit comments

Comments
 (0)