@@ -19,40 +19,6 @@ public SHA256DigitalSignatureWrapper()
1919 {
2020 }
2121
22- /// <summary>
23- /// Creates a SHA256 ED25519 Digital Signature.
24- /// </summary>
25- /// <param name="dataToSign"></param>
26- /// <returns></returns>
27- /// <exception cref="Exception"></exception>
28- public SHAED25519DalekDigitialSignatureResult CreateED25519 ( byte [ ] dataToSign )
29- {
30- if ( dataToSign == null || dataToSign . Length == 0 )
31- {
32- throw new Exception ( "You must provide an allocated array of data to sign to create a SHA256 Ed25519 Digital Signature" ) ;
33- }
34-
35- DateTime start = DateTime . UtcNow ;
36- SHAED25519DalekStructDigitalSignatureResult structResult =
37- ( this . _platform == OSPlatform . Linux ) ?
38- DigitalSignatureLinuxWrapper . sha256_ed25519_digital_signature ( dataToSign , dataToSign . Length ) :
39- DigitalSignatureWindowsWrapper . sha256_ed25519_digital_signature ( dataToSign , dataToSign . Length ) ;
40- byte [ ] publicKey = new byte [ structResult . public_key_length ] ;
41- byte [ ] signature = new byte [ structResult . signature_length ] ;
42- Marshal . Copy ( structResult . public_key , publicKey , 0 , publicKey . Length ) ;
43- Marshal . Copy ( structResult . signature_raw_ptr , signature , 0 , signature . Length ) ;
44- FreeMemoryHelper . FreeBytesMemory ( structResult . public_key ) ;
45- FreeMemoryHelper . FreeBytesMemory ( structResult . signature_raw_ptr ) ;
46- SHAED25519DalekDigitialSignatureResult result = new SHAED25519DalekDigitialSignatureResult ( )
47- {
48- PublicKey = publicKey ,
49- Signature = signature
50- } ;
51- DateTime end = DateTime . UtcNow ;
52- this . _sender . SendNewBenchmarkMethod ( MethodBase . GetCurrentMethod ( ) . Name , start , end , BenchmarkMethodType . DigitalSignature , nameof ( SHA256DigitalSignatureWrapper ) ) ;
53- return result ;
54- }
55-
5622 /// <summary>
5723 /// Creates a SHA256 RSA Digital Signature.
5824 /// </summary>
@@ -93,38 +59,6 @@ public SHARSADigitalSignatureResult CreateRsa(int rsaKeySize, byte[] dataToSign)
9359 return resultToReturn ;
9460 }
9561
96- /// <summary>
97- /// Verifies a SHA256 ED25519 Digital Signature.
98- /// </summary>
99- /// <param name="publicKey"></param>
100- /// <param name="dataToVerify"></param>
101- /// <param name="signature"></param>
102- /// <returns></returns>
103- /// <exception cref="Exception"></exception>
104- public bool VerifyED25519 ( byte [ ] publicKey , byte [ ] dataToVerify , byte [ ] signature )
105- {
106- if ( publicKey == null || publicKey . Length == 0 )
107- {
108- throw new Exception ( "You must provide an allocated public key" ) ;
109- }
110- if ( dataToVerify == null || dataToVerify . Length == 0 )
111- {
112- throw new Exception ( "You must provide an allocated data to verify" ) ;
113- }
114- if ( signature == null || signature . Length == 0 )
115- {
116- throw new Exception ( "You must provide an allocated signature " ) ;
117- }
118-
119- DateTime start = DateTime . UtcNow ;
120- bool result = ( this . _platform == OSPlatform . Linux ) ?
121- DigitalSignatureLinuxWrapper . sha256_ed25519_digital_signature_verify ( publicKey , publicKey . Length , dataToVerify , dataToVerify . Length , signature , signature . Length ) :
122- DigitalSignatureWindowsWrapper . sha256_ed25519_digital_signature_verify ( publicKey , publicKey . Length , dataToVerify , dataToVerify . Length , signature , signature . Length ) ;
123- DateTime end = DateTime . UtcNow ;
124- this . _sender . SendNewBenchmarkMethod ( MethodBase . GetCurrentMethod ( ) . Name , start , end , BenchmarkMethodType . DigitalSignature , nameof ( SHA256DigitalSignatureWrapper ) ) ;
125- return result ;
126- }
127-
12862 /// <summary>
12963 /// Verifies a SHA256 RSA Digital Signature.
13064 /// </summary>
0 commit comments