Tags: style blog http io ar color OS using SPSource: Tools for bulk decrypting various objects in SQL Server database Dbforge SQL decryptorTools for bulk decrypting various objects in SQL Server database Dbforge SQL Decryptor2.1.11Previously wrote an article using Redgate Company's SQL Prompt tool, but not very convenientSQLPROMPT5.3 decryption tests on various cryptographic objectsSQL2005 decryption of stored procedures that have been encryptedYesterday Ahdung child shoes introduced this tool t
Design:After BPE32 is called, the following three functional codes are generated in the memory:/------- + -------------------- +| Call decryptor | ---------> @ 1| + -------------------- +|| Encryptvirus body | ---------> @ 2|------> | -------------------- +|| Decryptor || ---------> @ 3+ -------------------- +@ 1 is a call constructed by computation, because the call location must be determined by @ 2.@ 2
data to a byte array. String original = "Here are some data to encrypt."; byte[] Toencrypt = Encoding.ASCII.GetBytes (original); Write all data to the crypto stream and flush it. Csencrypt.write (toencrypt, 0, toencrypt.length); Csencrypt.flushfinalblock (); Get the encrypted array of bytes. Byte[] encrypted = Msencrypt.toarray (); /**//////////////////////////////////////////////////////////This is where the data coul
");}}Overloaded version of the file encryption function, if you do not specify an output path,Then the original file will be overwritten by the encrypted filepublic void EncryptFile (string filePath){This. EncryptFile (Filepath,filepath);}Decrypt the given stringpublic string decryptstring (String str){Byte[] Ivb=encoding.ascii.getbytes (THIS.IV);Byte[] Keyb=encoding.ascii.getbytes (this. Encryptkey);Byte[] Todecrypt=this. Encodingmode.getbytes (str);Byte[] Decrypted=new byte[todecrypt.length];I
();Csencrypt.close ();}Catch{;}}}Else{throw new FileNotFoundException ("No specified file found");}}/**////Overloaded version of the file encryption function, if you do not specify an output path,Then the original file will be overwritten by the encrypted filepublic void EncryptFile (string filePath){This. EncryptFile (Filepath,filepath);}/**////Decrypt the given stringpublic string decryptstring (String str){Byte[] Ivb=encoding.ascii.getbytes (THIS.IV);Byte[] Keyb=encoding.ascii.getbytes (this
handler, and then add the following code to the event handler.
Try
{
Creates a Encryptor object, specifying 3DES as
Encryption algorithm
Encryptor enc = new Encryptor (encryptionalgorithm.tripledes);
Gets the connection string as a byte array
byte[] plaintext = Encoding.ASCII.GetBytes (Txtconnectionstring.text);
byte[] key = Encoding.ASCII.GetBytes (Txtkey.text);
Performing encryption
byte[] ciphertext = enc. Encrypt (plaintext, key);
Store initialization vectors, decryption requires
The vect
plaintext stream to the ciphertext stream (encrypted) based on the value enumerated by cryptostreammode ), or read the ciphertext stream into the plaintext stream (decryption ). The following is a helper class I have compiled for encryption and decryption:
// Symmetric encryption help classPublic class cryptohelper {
// Provides the symmetric encryption algorithm.Private icryptotransform encryptor; // encryptor objectPrivate icryptotransform decryptor
. cryptography. cryptostream decryptor = new system. Security. cryptography. cryptostream (Decryptstream, decrypttransform, system. Security. cryptography. cryptostreammode. Write );// Write a byte sequence to the current cryptostream (the decryption process is completed)Decryptor. Write (encryptbytes, 0, encryptbytes. Length );Decryptor. Close ();// Convert the
[] Encrypted = Msencrypt. toarray (); /**/ /**/ /**/ //////////////////////////////////////// /////////////// // This is where the data cocould be transmitted or saved. /**/ /**/ /**/ //////////////////////////////////////// /////////////// // Get a decryptor that uses the same key and IV as the encryptor. Icryptotransform decryptor = Rc2csp. createdecryptor (Key, IV ); // Now
(toencrypt,0,toencrypt.length);Csencrypt.flushfinalblock ();}catch (Exception err)... {throw new ApplicationException (err. message);}Finally... {Try... {Fout. Close ();Csencrypt.close ();}Catch... {;}}}Else... {throw new FileNotFoundException ("No specified file found");}}/**//**//**////Overloaded version of the file encryption function, if you do not specify an output path,Then the original file will be overwritten by the encrypted filepublic void EncryptFile (string filePath)... {This. Encry
enumerated by cryptostreammode ), or read the ciphertext stream into the plaintext stream (decryption ). The following is a helper class I have compiled for encryption and decryption:
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> // Symmetric encryption help class Public Class Cryptohelper { // Symmetric encryption algorithm provider Private Icryptotransform encryptor; // Encryptor object Private Icryptotra
disable the screen in various ways, so that the decryption cannot obtain any information returned by the tracing debugging software, to prevent the decryptor From deciphering the encryption system. This anti-tracking technology also has five types of implementation methods:
(1) screen blocking: You can reset the screen features to set the foreground color and background color to the same color, so that the decrypted cannot see debugging information
[] signature;Asypolicricprovider. importparameters (sender_privatekey );Signature = asypolicricprovider. signdata (encrypted. toarray (), new sha1cryptoserviceprovider ());}
The last output of the above four steps is encrypted, key, IV, and signature.
DEMO code for decryption:1. Get the key...2. Verify the Digital Signature...{Asyuncricprovider. importparameters (sender_publickey );Bool verify = asypolicricprovider. verifydata (encrypted, new sha1cryptoserviceprovider (), signature)}3. decry
DESCryptoServiceProvider ();Cryptoprovider.mode = CIPHERMODE.CBC;cryptoprovider.padding = Paddingmode.zeros;Try{Open up a memory stream and store the ciphertextusing (MemoryStream Memory = new MemoryStream (Data)){Wraps the memory stream object into an encrypted stream objectusing (CryptoStream decryptor = new CryptoStream (Memory,Cryptoprovider.createdecryptor (Bkey, Bvector),CryptoStreamMode.Read)){Clear Text Storage Areausing (MemoryStream origina
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.