Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specified Method is not supported. #15

Open
vaz83 opened this issue Aug 17, 2020 · 1 comment
Open

Specified Method is not supported. #15

vaz83 opened this issue Aug 17, 2020 · 1 comment

Comments

@vaz83
Copy link

vaz83 commented Aug 17, 2020

Hi,
i'm trying to encrypt data, but i am having a Specified Method is not supported.

Target is a Windows application, .NET 4.5.2

protected RSACryptoServiceProvider CreateProvider()
        {
            var privateKeyText = GetPrivateKey();

            IOpenSSLPrivateKeyDecoder decoder = new OpenSSLPrivateKeyDecoder();
            var RSA1 = decoder.Decode(privateKeyText);

            return RSA1;

        }

        public static string Encrypt(string decryptedData)
        {
            Utils c = new Utils();
            
            var val =  c.CreateProvider().SignData(new UTF8Encoding().GetBytes(decryptedData), CryptoConfig.MapNameToOID("SHA1"));
            return Convert.ToBase64String(val);
        }

I call the function Encrypt, but when it's called the CreateProvider() function, on the " var RSA1 = decoder.Decode(privateKeyText);" it gives the exception.

Any ideas?

@StefH
Copy link
Owner

StefH commented Aug 21, 2020

Hello @vaz83 ,

Can you please provide a full working example ? It's very difficult for me to understand the error based on your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants