本文整理汇总了C#中System.Security.Cryptography.RSA.ToXmlString方法的典型用法代码示例。如果您正苦于以下问题:C# RSA.ToXmlString方法的具体用法?C# RSA.ToXmlString怎么用?C# RSA.ToXmlString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Cryptography.RSA
的用法示例。
在下文中一共展示了RSA.ToXmlString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Product
public Product()
{
_key = RSA.Create();
_id = Guid.NewGuid();
_issuedLicenses = new ObservableCollection<License>();
_publicKey = _key.ToXmlString(false);
_privateKey = _key.ToXmlString(true);
}
示例2: WriteKey
public static void WriteKey(Stream file, String password, RSA rsa)
{
byte[] key = DeriveBytes(file, password);
byte[] iv = DeriveBytes(file, password);
using (var aes = new RijndaelManaged { KeySize = BlockSize * 8, BlockSize = BlockSize * 8, Key = key, IV = iv })
using (var transform = aes.CreateEncryptor())
using (var stream = new CryptoStream(file, transform, CryptoStreamMode.Write))
using (var writer = new StreamWriter(stream)) {
writer.Write(rsa.ToXmlString(true));
}
}
示例3: SetPublicKey
void SetPublicKey(RSA rsa)
{
SetText(rsaKey, XElement.Parse(rsa.ToXmlString(false)).ToString());
}
示例4: BruteForce
bool BruteForce(MSX.PKCS12 pfx)
{
foreach (object o in pfx.Keys) {
key = (o as RSA);
if (key == null)
continue;
string s = key.ToXmlString (false);
foreach (MSX.X509Certificate cert in pfx.Certificates) {
if (s == cert.RSA.ToXmlString (false))
x509 = new X509Certificate (cert.RawData);
}
// complete ?
if ((x509 != null) && (key != null))
return true;
}
return false;
}
示例5: Matches
public bool Matches (RSA rsa)
{
// hmm, there should be more decent way to compare ...
return rsa.ToXmlString (false) == this.rsa.ToXmlString (false);
}