CryptoAPI 

  
Ricardo I need yout help.

I need encryption a string , example:
string for encyption -

login=1009512&senha=minhasenha&data=2015-05-20T09:15:38-03:00
format RSA-SHA256 and using key públic in file XML or PEM.

and convert in Base64

How i do? its api enables this?

thanks!
Hello Vanderson,

Exactly what do you mean by RSA-SHA256 format ?

As mentioned in the documentation, the RSA actions for Crypto API use PKCS #1 OAEP encryption with SHA1 and MFG1 as the parameter functions. Do you mean you need to use SHA256 as the parameter function for OAEP RSA encryption schema ?

The output is already converted to Base64, so that shouldn't be an issue.

In CryptoAPI I currently only support the definition of the keys using the XML format output by Microsoft.

Perhaps the best way to help you would be if you could provide a sample RSA public key and sample code (.NET, Java, some other language) of what's supposed to work for your system, that way it would be easier for me to investigate the format being used.

Can you please provide one of those?

Best regards,
Ricardo Silva
Ricardo Silva wrote:
Hi Ricardo, my question is which functions I use in what sequence??

thanks
Hello Vanderson,

Exactly what do you mean by RSA-SHA256 format ?

As mentioned in the documentation, the RSA actions for Crypto API use PKCS #1 OAEP encryption with SHA1 and MFG1 as the parameter functions. Do you mean you need to use SHA256 as the parameter function for OAEP RSA encryption schema ?

The output is already converted to Base64, so that shouldn't be an issue.

In CryptoAPI I currently only support the definition of the keys using the XML format output by Microsoft.

Perhaps the best way to help you would be if you could provide a sample RSA public key and sample code (.NET, Java, some other language) of what's supposed to work for your system, that way it would be easier for me to investigate the format being used.

Can you please provide one of those?

Best regards,
Ricardo Silva
 
 
Yes, the CryptoAPI allows you to encrypt a function using RSA. The output is Base64 encoded.

What you need to do is:

The person you want to encrypt the message to provides you with the public key in XML format and you call the RSAEncrypt action with the XML as the first parameter and the text you want to encrypt as the second parameter. This will use an encryption schema which is usually available in crypto libraries, so you should be ok using it.

I hope this allows you to overcome your difficulties.

Best regards,
Ricardo Silva
one question more , what crytpconfig you use the RSAEncrypt - SHA256? or what?

thanks



I don't use any special CryptoConfig and am not even sure what you're talking about.

I use the Encrypt method of the RSACryptoServiceProvider class. You can open the source code yourself to see how it is done.

Can you please provide a code example of how you wish your encryption to be made?
Is possible send your source code about RSAEncrypt ? In C#?

Please.

thanks

the code is available in the extension, you can open it via Integration Studio.

Nevertheless the code is also available in github, here.

As you can see, the code is:

        public static string rsa_encrypt(string publicKey, string plaintext)
        {
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
            rsa.FromXmlString(publicKey);
            return Convert.ToBase64String(rsa.Encrypt(Encoding.UTF8.GetBytes(plaintext), true));
        }
 
thank you on Monday will test what with this problem!