kullanarak şifrelenmiş dizesinde nokta üst üste almak mı ki ben sonradan tasarruf Böyle bir nokta üst üste ile ayrı bir dizede:mümkün ben bir şifre şifrelemek için yönteminin altında kullanıyorum Base64
kullanıcı adı: MyEncryptedString
Benim sorum şu ki, yöntemim bir iki nokta üst üste içeren bir dize döndürüyor olabilir mi?
public static string EncryptString(string password, string sharedSecret) {
if (string.IsNullOrEmpty(password))
throw new ArgumentNullException("password");
if (string.IsNullOrEmpty(sharedSecret))
throw new ArgumentNullException("sharedSecret");
string outStr = null; // Encrypted string to return
RijndaelManaged aesAlg = null; // RijndaelManaged object used to encrypt the data.
try {
// generate the key from the shared secret and the salt
Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(sharedSecret, Salt);
// Create a RijndaelManaged object
aesAlg = new RijndaelManaged();
aesAlg.Key = key.GetBytes(aesAlg.KeySize/8);
// Create a decryptor to perform the stream transform.
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
// Create the streams used for encryption.
using (MemoryStream msEncrypt = new MemoryStream()) {
// prepend the IV
msEncrypt.Write(BitConverter.GetBytes(aesAlg.IV.Length), 0, sizeof(int));
msEncrypt.Write(aesAlg.IV, 0, aesAlg.IV.Length);
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)) {
using (StreamWriter swEncrypt = new StreamWriter(csEncrypt)) {
//Write all data to the stream.
swEncrypt.Write(password);
}
}
outStr = Convert.ToBase64String(msEncrypt.ToArray());
}
} finally {
// Clear the RijndaelManaged object.
if (aesAlg != null)
aesAlg.Clear();
}
// Return the encrypted bytes from the memory stream.
return outStr;
}
Base64 kodlaması, Rijndael'in ne yaptığı önemli değil, Base64 kodlamasının ne yapması gerektiği (ipucu: Base64 kodonları içermiyor) – DavidG
Teşekkür ederiz. Soruyu daha iyi düzenlediniz :) – MrProgram