Browse Source

fcl-hash: added rsa test

mattias 3 years ago
parent
commit
7664b32e5f
1 changed files with 9 additions and 3 deletions
  1. 9 3
      packages/fcl-hash/tests/utestpem.pp

+ 9 - 3
packages/fcl-hash/tests/utestpem.pp

@@ -5,7 +5,7 @@ unit utestpem;
 interface
 
 uses
-  Classes, SysUtils, fpcunit, testregistry, fpasn, fppem;
+  Classes, SysUtils, fpcunit, testregistry, fpasn, fppem, fprsa;
 
 Type
 
@@ -14,13 +14,13 @@ Type
   TTestPEM = Class(TTestCase)
   Published
     Procedure TestLoad;
+    Procedure TestRSA_RS256Verify;
   end;
 
 implementation
 
 uses basenenc, fphashutils, fpecc;
 
-
 { TTestPEM }
 Const
   PrivateKeyFile = 'private-key.pem';
@@ -55,7 +55,7 @@ begin
   try
     Res:=FileExists(PrivateKeyFile) and PemIsECDSA(PrivateKeyFile, List);
     if Res then
-       PemLoadPublicKey64FromList(List, PrivateKey, PublicKey, PublicKeyX64, PublicKeyY64);
+      PemLoadPublicKey64FromList(List, PrivateKey, PublicKey, PublicKeyX64, PublicKeyY64);
     AssertEquals('Private key',resprivatekey,BytesToHexStr(BytesFromVar(@PrivateKey,Sizeof(PrivateKey))));
     AssertEquals('Public  key',respublickey,BytesToHexStr(BytesFromVar(@PublicKey,Sizeof(PublicKey))));
     AssertEquals('X',resX,PublicKeyX64);
@@ -71,6 +71,12 @@ begin
   end;
 end;
 
+procedure TTestPEM.TestRSA_RS256Verify;
+begin
+  if not fprsa.TestRS256Verify then
+    Fail('TestRS256Verify');
+end;
+
 initialization
   RegisterTest(TTestPEM);
 end.