0

2 人のユーザーが同じパスワードを入力すると、DB 内の値は同じになります。

アドバイスをお願いします

#region "Digital Signature"
public static String EncryptDS (this String dataToEncrypt)
{
  //Convert dataToEncrypt to byte array
  byte[] plainTextBytes = Encoding.Unicode.GetBytes(dataToEncrypt);
  //===================================
  //Create Crypto Service provides params (24 allows SHA256 hashing alogrithm)
  CspParameters cspParams = new CspParameters();
  cspParams = new CspParameters(24);
  cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
  cspParams.KeyContainerName = "TT_KEY";
  //====================================
  //Generate asymmetric key
  RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cspParams);
  //=====================================
  //hash and then encrypt the hash(digitally sign)
  byte[] sig = rsa.SignData(plainTextBytes, "SHA256");
  //=====================================
  //Return signed encrypt the hash (digitally sign)
  return Convert.ToBase64String(sig);
}
4

1 に答える 1