public virtual JObject GetPublicKey(HttpContext context) { RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024); string publicKey = rsaProvider.ToXmlString(false); string privateKey = rsaProvider.ToXmlString(true); string keystore = YZTempStorageManager.CurrentStore.Save(privateKey); string publicKeyPKCS = YZSecurityHelper.RSAPublicKeyDotNet2PCKS(publicKey); JObject rv = new JObject(); rv["success"] = true; rv["publicKey"] = publicKeyPKCS; rv["keystore"] = keystore; return(rv); }
public virtual void GetPublicKey() { RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024); string publicKey = rsaProvider.ToXmlString(false); string privateKey = rsaProvider.ToXmlString(true); string keystore = YZTempStorageManager.CurrentStore.Save(privateKey); string publicKeyPKCS = YZSecurityHelper.RSAPublicKeyDotNet2PCKS(publicKey); JObject rv = new JObject(); rv["success"] = true; rv["publicKey"] = publicKeyPKCS; rv["keystore"] = keystore; this.Response.Write(rv.ToString(Formatting.Indented, YZJsonHelper.Converters)); this.Response.End(); }