/// <summary> /// The command method to verify a signature /// </summary> private void Verify() { var pubKey = File.ReadAllBytes(KeyPairSetup.PublicKeyFilePath); var signature = ByteConvert.HexStringToBytes(OriginalSignature); byte[] data = null; switch (DataInput.DataFormatSelected) { case Format.File: data = File.ReadAllBytes(DataInput.Data); break; case Format.Text: data = ByteConvert.StringToUTF8Bytes(DataInput.Data); break; } SignatureVerified = KeyPairSetup.Verify(signature, pubKey, data); }
/// <summary> /// The command method to sign some data /// </summary> private void Sign() { var privKey = File.ReadAllBytes(KeyPairSetup.PrivateKeyFilePath); byte[] data = null; switch (DataInput.DataFormatSelected) { case Format.File: data = File.ReadAllBytes(DataInput.Data); break; case Format.Text: data = ByteConvert.StringToUTF8Bytes(DataInput.Data); break; } var signature = KeyPairSetup.Sign(privKey, data); OriginalSignature = ByteConvert.BytesToHexString(signature); }