Is there a way to determine if a string is RSA encrypted?

I have a function that will encrypt an decrypt using System.Security.Cryptography and the RSA algorithim.  Is there a way to determine if the string is already encrypted?
Elliott WardSoftware DeveloperAsked:
Who is Participating?
 
CodeCruiserCommented:
There is no magical way of finding that out unless you use some sort of flag to indicate whether or not the field is encrypted.
0
 
CodeCruiserCommented:
One way is to try to decrypt it and if its succeeds then its encrypted.
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
I'm agreed with CodeCruiser, but taking into account that the common use of that algorithm is to encrypt small piece of data maybe you can also rely on the fixed size in bytes (128, 512, etc...) of your data to check if it is encrypted, with little performance penalty, if that is your concern.
0
 
Elliott WardSoftware DeveloperAuthor Commented:
What I am really after is tryiing to figure out if a string field is unencrypted or not.
0
 
Elliott WardSoftware DeveloperAuthor Commented:
No solution was possible but the question was answered completely and accurately
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.