Created
          February 29, 2016 08:22 
        
      - 
      
- 
        Save Jaymo/6b683c6aee3ba949533c to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | private static final String RANDOM_ALGORITHM = "SHA1PRNG"; | |
| public static final int IV_LENGTH = 16; | |
| private byte[] generateIv() throws NoSuchAlgorithmException, NoSuchProviderException { | |
| SecureRandom random = SecureRandom.getInstance(RANDOM_ALGORITHM); | |
| byte[] iv = new byte[IV_LENGTH]; | |
| random.nextBytes(iv); | |
| return iv; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment