Note that there are some explanatory texts on larger screens.

plurals
  1. PORSA Encryption in c# using Exponent, Modulus and Base as parameters
    primarykey
    data
    text
    <p>I have a proprietary application that uses an extension to handle cryptography. To encrypt a string I feed it Exponent, Modulus, Base and string as parameters. It returns the encrypted string.</p> <p>I need to be able to replicate this functionality in a c# application that talks to the proprietary application. I'm unsure where to begin with this – and would appreciate any help you can give.</p> <p>This is what I have at the moment;</p> <pre><code>public class Cryptography { public static RSACryptoServiceProvider rsa; public static void AssignParameter() { const int PROVIDER_RSA_FULL = 1; const string CONTAINER_NAME = "SpiderContainer"; CspParameters cspParams; cspParams = new CspParameters(PROVIDER_RSA_FULL); cspParams.KeyContainerName = CONTAINER_NAME; //cspParams.Flags = CspProviderFlags.UseMachineKeyStore; cspParams.ProviderName = "Microsoft Strong Cryptographic Provider"; rsa = new RSACryptoServiceProvider(cspParams); } public static string Sencrypt(string input) { RSAParameters parameters = new RSAParameters(); parameters.Modulus = System.Text.Encoding.Unicode.GetBytes("nononomonomnomfoononmo"); parameters.Exponent = System.Text.Encoding.Unicode.GetBytes("b"); rsa.ImportParameters(parameters); byte[] plainbytes = System.Text.Encoding.UTF8.GetBytes(input); byte[] cipherbytes = rsa.Encrypt(plainbytes, false); System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); //return enc.GetString(cipherbytes); return Convert.ToBase64String(cipherbytes); } } </code></pre> <p>When I encrypt data using the proprietary application, and then try using the above code - the resulting encrypted data is different.</p> <p>I'm at a loss at how to proceed.</p> <p>edit; It returns a different string everytime it's ran. Using the same input string. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload