Skip to content

How to encrypt & decrypt a text ? #15

Discussion options

You must be logged in to vote

To encrypt and decrypt a text use : MBSecurity.MBString static class.

Example 1 : Encrypt a text using your custom Key

string S = "Welcome to MB Security";

//Encrypt string
var EncryptedData = new MBSecurity.StrEncryptionModel();
EncryptedData = MBSecurity.MBString.Encrypt( S , "ImTheKey" );

//Get the encrypted string and used key
string Encrypted_String = EncryptedData.EncryptedText;
string Encrypted_Key = EncryptedData.Key;

Console.WriteLine( $"Encrypted text : {Encrypted_String}" );
Console.WriteLine( $"Encrypted key : { Encrypted_Key}" );

Notes :

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MbarkT3STO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant