DSA and RSA can be used, such as:
using System;
using ;
using ;
class dsacrypto_SignData {
public static void Main(String[] args){
//First convert the string into a byte array, which is related to encoding.
String str = "this is a test.";
byte[] bytes = (str);
//Select the signature method, there are RSA and DSA
DSACryptoServiceProvider dsac = new DSACryptoServiceProvider();
byte[] sign = (bytes);
//sign is the result of the signature.
//The following is the certification
DSACryptoServiceProvider dsac2 = new DSACryptoServiceProvider();
((false));
bool ver = (bytes, sign);
if (ver) {
("pass");
} else {
("Cannot pass");
}
}
}
RSA is similar, but RSA is much slower than DSA, but safer than DSA. RSA can choose the size of the keyword, the larger the safer it is
using System;
using ;
using ;
class dsacrypto_SignData {
public static void Main(String[] args){
//First convert the string into a byte array, which is related to encoding.
String str = "this is a test.";
byte[] bytes = (str);
//Select the signature method, there are RSA and DSA
DSACryptoServiceProvider dsac = new DSACryptoServiceProvider();
byte[] sign = (bytes);
//sign is the result of the signature.
//The following is the certification
DSACryptoServiceProvider dsac2 = new DSACryptoServiceProvider();
((false));
bool ver = (bytes, sign);
if (ver) {
("pass");
} else {
("Cannot pass");
}
}
}
RSA is similar, but RSA is much slower than DSA, but safer than DSA. RSA can choose the size of the keyword, the larger the safer it is