Thread: Easy AES Encryption/Decryption

Results 1 to 3 of 3
  1. #1 Easy AES Encryption/Decryption 
    Registered Member
    Join Date
    Jun 2015
    Posts
    1
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    What is AES?
    AES is stands for Acronym of Advanced Encryption Standard which is an encrypting algorithm. In this algorithm you can use a 128-bit, 192-bit, or 256-bit long key for encrypting and decrypting data.

    When is it helpful to use AES?
    Anytime you want to hide information from your users.

    Is AES secure?
    AES has been adopted by the U.S. government and is now used worldwide.
    AES is may not be secure for highly classified information but, however for the small to larger applications it is.

    Here's a chart of possible combinations
    =

    What are some open-source alternatives?

    AES Crypt: (Same but I will show you the differences)
    • Platforms: Windows, OSX, Linux (Crypt4All Lite for Android is compatible)
    • Encryption: AES_256
    • Pros: Per file encryption, very easy to use
    • Cons: individual file encryption only


    AxCrypt
    • Platform: Windows
    • Encryption: AES_128 with HMAC-SHA1-128 data verification
    • Pros: Per file encryption, right-click OS integration, can encrypt all files in a folder and multiple files at once, can use keyfile instead of a passphrase (more secure as greater entropy), more options than AES Crypt, stand-alone portable version available, very easy to use
    • Cons: Windows only


    DiskCryptor
    • Platform: Windows
    • Encryption: AES_256, Twofish and Serpent
    • Pros: Full disk encryption (including OS disk), setup file only 1Mb, can use key file instead of password
    • Cons: No per-file or per-folder encryption, no ‘hidden volumes’, no ‘hide drive’ option, unmounted drives still visible to system, Windows only


    dm-Crypt/LUKS
    • Platforms: Linux, DragonFly BSD, Android (Rooted only, using LUKS Manager)
    • Encryption: Large library available, including blowfish, twofish and AES
    • Pros: Very capable full disk encryption
    • Cons: For experts only, impenetrable documentation


    EncFS
    • Platforms: Linux, Windows (using encfs4win), Android (using Cryptonite app). With a bit of effort it is possible to get EncFS to run in OSX *.
    • Encryption: whatever libraries are available, usually Blowfish and AES. ‘Paranoid mode’ uses AES_256, , ‘filename block encoding with IV chaining per file, external IV chaining, MAC block headers’
    • Pros: Easy to use, great for secure cloud storage, files encrypted individually
    • Cons: Files in ‘personal’ folder are not encrypted, metadata (i.e. filenames and when a file is uploaded is modified in the cloud) is visible. Note that these are not really ‘cons’, but the logical consequences of EncFS’s strengths. Users should be aware of them however.


    Secrecy
    • Platforms: Android
    • Encryption: AES_256
    • Pros: Stealth mode to hide vaults, leaves no trace of any temporary files in the system
    • Cons: Does not delete original files, can be somewhat slow, still very much in alpha development


    I was looking around for various types of encryption in java and saw this which may be helpful to some. This has probably been released before if it has just let me know.

    You can easily encrypt or decrypt any String, useful for passwords or anything you want to hide.

    Example:

    Code:
    Origninal
    MPGBXOaOKlulJUPcIJOr7w==	NWTFcOwkohS7pEGJWCJOAA==	N1yBiibb6VgkDEBBbrykAQ==	tsVvZiKTjoGtVUrMmvvi2A==	
    Decrypted : YouTube, myYoutubePass#, 7/20/15, N/A
    
    Origninal
    x5jtavN4Zcre4p7/sSLChw==	EwZePH7hTi1TU+QD7TYEZw==	iF6xUrGTiIXxrsHoM2LLnw==	tsVvZiKTjoGtVUrMmvvi2A==	
    Decrypted : My20Emails, abc123#, 07/24/2015, N/A
    
    Origninal
    VHVKdHzl4tV0ukwAZgGiTg==	3cqS9Zo+kBQ3dDiOGtiMHQ==	iF6xUrGTiIXxrsHoM2LLnw==	tsVvZiKTjoGtVUrMmvvi2A==	
    Decrypted : RS, whosanoob, 07/24/2015, N/A
    
    Origninal
    U7+XLGJq4ADy1lGz9NqTzg==	ZJGkrLqbCBvM9m3NvqdR9g==	iF6xUrGTiIXxrsHoM2LLnw==	tsVvZiKTjoGtVUrMmvvi2A==	
    Decrypted : FaceBook, Password, 07/24/2015, N/A
    Example usage in an application



    Code:
    	private void loadEntries() {
    		try {
    			String file = "./data/data.dat";
    			BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
    			
    			String line = br.readLine();			
    
    			while ((line = br.readLine()) != null) {
    				System.out.println("Origninal");
    				System.out.println(line);
    				
    				String[] encryptedData = line.replaceAll("\t", " ").split(" ");
    				
    				String encryptedName = encryptedData[0];
    				String encrpytedPass = encryptedData[1];
    				String encryptedDate = encryptedData[2];
    				String encryptedDate2 = encryptedData[3];
    				
    				String encryptionKey = "ZmBe$oDUw34SfwXg";
    				EncryptionStandard advancedEncryptionStandard = new EncryptionStandard(
    						encryptionKey);
    				String decryptedUser = advancedEncryptionStandard
    						.decrypt(encryptedName);
    				String decryptedPass = advancedEncryptionStandard
    						.decrypt(encrpytedPass);
    				String decryptedDate = advancedEncryptionStandard
    						.decrypt(encryptedDate);
    				String decryptedDate2 = advancedEncryptionStandard
    						.decrypt(encryptedDate2);
    				
    				System.out.println("Decrypted : " + decryptedUser + ", " + decryptedPass + ", "
    						+ decryptedDate + ", " + decryptedDate2);
    			}			
    			br.close();
    		} catch (FileNotFoundException e) {
    			e.printStackTrace();
    		} catch (IOException e) {
    			e.printStackTrace();
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    You'll have to use the apache commons library which can be found here.

    Codec – Download Apache Commons Codec

    Code:
    import javax.crypto.Cipher;
    import javax.crypto.spec.SecretKeySpec;
    import org.apache.commons.codec.binary.Base64;
    
    public class EncryptionStandard
    {
        private String encryptionKey;
    
        public EncryptionStandard(String encryptionKey)
        {
            this.encryptionKey = encryptionKey;
        }
    
        public String encrypt(String plainText) throws Exception
        {
            Cipher cipher = getCipher(Cipher.ENCRYPT_MODE);
            byte[] encryptedBytes = cipher.doFinal(plainText.getBytes());
    
            return Base64.encodeBase64String(encryptedBytes);
        }
    
        public String decrypt(String encrypted) throws Exception
        {
            Cipher cipher = getCipher(Cipher.DECRYPT_MODE);
            byte[] plainBytes = cipher.doFinal(Base64.decodeBase64(encrypted));
    
            return new String(plainBytes);
        }
    
        private Cipher getCipher(int cipherMode)
                throws Exception
        {
            String encryptionAlgorithm = "AES";
            SecretKeySpec keySpecification = new SecretKeySpec(
                    encryptionKey.getBytes("UTF-8"), encryptionAlgorithm);
            Cipher cipher = Cipher.getInstance(encryptionAlgorithm);
            cipher.init(cipherMode, keySpecification);
    
            return cipher;
        }
    }
    Usage

    Code:
    import javax.swing.JOptionPane;
    
    public class Main {
    
    	public static void main(String[] args) throws Exception {
    		String encryptionKey = "ZmBe$oDUw34SfwXg"; //Key must be 16 characters long (Can consist of letters, numeric values and special type characters)
    		String plainText = JOptionPane.showInputDialog("Enter something");
    		EncryptionStandard advancedEncryptionStandard = new EncryptionStandard(
    				encryptionKey);
    		String cipherText = advancedEncryptionStandard.encrypt(plainText);
    		String decryptedCipherText = advancedEncryptionStandard
    				.decrypt(cipherText);
    
    		System.out.println(plainText);
    		System.out.println(cipherText);
    		System.out.println(decryptedCipherText);
    	}
    }
    Reply With Quote  
     

  2. #2  
    Extreme Donator

    Join Date
    Sep 2015
    Age
    25
    Posts
    113
    Thanks given
    0
    Thanks received
    1
    Rep Power
    42
    Thanks for this. Will take this into consideration.
    Reply With Quote  
     

  3. #3  
    fumant viriditas quotidiana

    saifix's Avatar
    Join Date
    Feb 2009
    Age
    30
    Posts
    1,237
    Thanks given
    275
    Thanks received
    957
    Rep Power
    3304
    you should link to where you took the images and pros / cons from https://www.bestvpn.com/blog/10995/6...-to-truecrypt/

    edit: oh hey you did! rep++
    "Im so bluezd out of my box.
    Im so fkd i canr even sens makeas Smoke blunt 420hash e tizday" - A legendary guy (1993 - 2015)
    Quote Originally Posted by nmopal View Post
    I will be creating a grimy dubstep song using these lyrics and vocaloid please prepare your bodies
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Php Blowfish Encryption/Decryption
    By OG KingFox in forum Website Development
    Replies: 6
    Last Post: 12-01-2016, 02:45 PM
  2. Encrypting/Decrypting Strings custom way
    By Wildskiller in forum Snippets
    Replies: 4
    Last Post: 08-10-2013, 07:25 AM
  3. How to get rid of Encrypted Rats and Decrypted
    By Pokemon in forum Software
    Replies: 8
    Last Post: 12-29-2012, 11:29 AM
  4. 718 SHA-1 Encrypted Algorithm Decrypt
    By Verdictus in forum Help
    Replies: 1
    Last Post: 09-26-2012, 03:16 AM
  5. Text Encrypting/Decrypting
    By Vastiko in forum Requests
    Replies: 9
    Last Post: 04-26-2010, 08:55 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •