Home Screen :

Name of Experiment : Digital Signature

Exp No : MC14

Background : Student should have basic knowledge of C#.

Summary : Digital Signature is mainly for the authentication of Message. People used to sign their digital data with digital signature that prove their authenticity during message transfer. This aspect of security is very much needed in present life.

Learning Objective : Student is able to learn the way of authentication through digital signature.


Target Platform : This experiment is tested on Windows Phone Emulator and Nokia Lumia 800.



Source Code : Comments :
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>

<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ExperimentTitle" Text="ExpNo MC14" TextAlignment="Right" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="ApplicationTitle" Text="Mobile Computing" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Digital Signature" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<TextBlock x:Name="tbMessage" Text="Message" Height="50" Margin="12" Grid.Row="1" Grid.Column="0" Width="100"/>
<TextBox x:Name="txtMessg" Height="72" Grid.Row="1" Grid.Column="1" Width="330" TextWrapping="Wrap" />
<Button Content="GetHash" Click="Button_Click" Grid.Row="2" Grid.Column="1" Width="330" Height="72" Background="Black"/>
<TextBox x:Name="txtHash" Height="127" Grid.Row="3" Grid.ColumnSpan="2" TextWrapping="Wrap" Width="448" BorderBrush="Green" Background="Black" Foreground="White" FontSize="{StaticResource PhoneFontSizeSmall}" />
<Button x:Name="bVerify" Content="Verify" Grid.Row="4" Grid.Column="1" Height="72" Click="bVerify_Click"/>
<Button x:Name="bReset" Content="Reset" Grid.Row="4" Grid.Column="0" Height="72" Click="bReset_Click"/>


 Exp No MC14(Experiment title)

 Mobile Computing(Application title)
 Digital Signature (Page Title)

using System;
using System.Security.Cryptography;
using System.Text;

namespace DigitalSignature
public class Signature
public static string GetSignature(string plaintxt){
StringBuilder str = new StringBuilder();
SHA1Managed sha1 = new SHA1Managed();
byte[] hashValue = sha1.ComputeHash(Encoding.Unicode.GetBytes(plaintxt));
for (int counter = 0; counter < hashValue.Length; counter++) {
return str.ToString();
public static bool VerifyHash(string plaintxt,string prevHashValue ) {
string hashValue2 = GetSignature(plaintxt);
StringComparer strComparer = StringComparer.OrdinalIgnoreCase;
if (strComparer.Compare(hashValue2, prevHashValue).Equals(0))
return true;
else {
return false;



 Signature class

 GetSignature Method Body

 VerifyHash Method Body



Observation : It is observed by developer that Digital Signature can be implemented in variety of application.

Video Link

For Windows Phone


Right Click Here And Select Save Target For Entire Download :

Digital Signature Experiment