I need to be able to decrypt a string that is encrypted with a certificate using SHA1-RSA. This is being used to integrate a .NET application with authentication from an existing system that cannot be changed.
Please provide sample code, or a link to a sample project. C# or VB.NET code is fine and I would prefer code that is compatible with both .NET 1.1 and .NET 2.0. I would like to avoid third-party components as the procurement process for this client is rather slow and painful.
If it helps, the following Java code encrypted what I need to decrypt.
public String createUrlFragment(String privateKeyName, String privateKeyPassword, String authString) throws UrlAuthenticationException
PrivateKey privateKey = (PrivateKey) _keyStore.getKey(privateKeyName, privateKeyPassword.toCharArray());
Enumeration e = _keyStore.aliases();
System.out.println("alais:" + (String)e.nextElement());
if (privateKey == null)
throw new UrlAuthenticationException("No key " + privateKeyName + " found");
Signature signature = Signature.getInstance("SHA1withRSA");
byte sig1 = signature.sign();
String base64 =Base64.encodeBytes(sig1);
String urlFragment = "user=" + URLEncoder.encode(authString,"UTF-8") + "&authSignature=" + URLEncoder.encode(base64,"UTF-8");
catch (Exception e)
throw new UrlAuthenticationException("UrlAuthenticationException: " + e.toString());