diff --git a/Ed25519/Ed25519.xml b/Ed25519/Ed25519.xml index fc79c2b..31c63d3 100644 --- a/Ed25519/Ed25519.xml +++ b/Ed25519/Ed25519.xml @@ -47,5 +47,23 @@ The entire path to the corresponding file. The desired key. + + + Signs a message with the given private and public keys. + + The message to sign. + The desired private key. + The corresponding public key. + The derived signature. It's length is always 64 bytes! + + + + Validates a given signature by means of the given public key. + + The signature to validate. + The corresponding message. + The used public key. + Returns true when the combination of signature + message is valid. + diff --git a/Ed25519/Signer.cs b/Ed25519/Signer.cs index 2cf3757..ac0360c 100644 --- a/Ed25519/Signer.cs +++ b/Ed25519/Signer.cs @@ -41,6 +41,13 @@ namespace Ed25519 /// The desired key. public static ReadOnlySpan LoadKey(string filename) => !File.Exists(filename) ? ReadOnlySpan.Empty : File.ReadAllBytes(filename); + /// + /// Signs a message with the given private and public keys. + /// + /// The message to sign. + /// The desired private key. + /// The corresponding public key. + /// The derived signature. It's length is always 64 bytes! public static ReadOnlySpan Sign(ReadOnlySpan message, ReadOnlySpan privateKey, ReadOnlySpan publicKey) { if(privateKey.Length != Constants.BIT_LENGTH / 8) @@ -94,6 +101,13 @@ namespace Ed25519 } } + /// + /// Validates a given signature by means of the given public key. + /// + /// The signature to validate. + /// The corresponding message. + /// The used public key. + /// Returns true when the combination of signature + message is valid. public static bool Validate(ReadOnlySpan signature, ReadOnlySpan message, ReadOnlySpan publicKey) { if (signature.Length != Constants.BIT_LENGTH / 4)