public ToXmlString ( bool includePrivateParameters ) : string | ||
includePrivateParameters | bool | |
Résultat | string |
public Product() { _key = RSA.Create(); _id = Guid.NewGuid(); _issuedLicenses = new ObservableCollection<License>(); _publicKey = _key.ToXmlString(false); _privateKey = _key.ToXmlString(true); }
/// <summary> /// Erstellt ein neues Schlüsselpaar /// </summary> /// <returns></returns> public static string[] CreateNewKeys() { System.Security.Cryptography.RSA rsa = System.Security.Cryptography.RSA.Create(); return(new[] { rsa.ToXmlString(true), //PrivateKey rsa.ToXmlString(false) //PublicKey }); }
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)); } }
void SetPublicKey(RSA rsa) { SetText(rsaKey, XElement.Parse(rsa.ToXmlString(false)).ToString()); }
public string GetPublicKey() { return(rsa.ToXmlString(false)); }
public override string ToXmlString(bool includePrivateParameters) => _impl.ToXmlString(includePrivateParameters);
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; }
public bool Matches (RSA rsa) { // hmm, there should be more decent way to compare ... return rsa.ToXmlString (false) == this.rsa.ToXmlString (false); }