All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.vt.middleware.crypt.KeyWithIV Maven / Gradle / Ivy

There is a newer version: 2.2
Show newest version
/*
  $Id$

  Copyright (C) 2007-2010 Virginia Tech.
  All rights reserved.

  SEE LICENSE FOR MORE INFORMATION

  Author:  Middleware Services
  Email:   [email protected]
  Version: $Revision$
  Updated: $Date$
*/
package edu.vt.middleware.crypt;

import javax.crypto.SecretKey;

/**
 * Container for a symmetric key and IV generated from a passphrase for use in
 * PBE encryption.
 *
 * @author  Middleware Services
 * @version  $Revision: 3 $
 */
public class KeyWithIV
{

  /** Symmetric key. */
  private SecretKey secretKey;

  /** Initialization vector. */
  private byte[] iv;


  /**
   * Creates a new instance from the given key and IV.
   *
   * @param  key  Symmetric key.
   * @param  ivBytes  Initialization vector bytes.
   */
  KeyWithIV(final SecretKey key, final byte[] ivBytes)
  {
    this.secretKey = key;
    this.iv = ivBytes;
  }


  /**
   * Gets the symmetric key.
   *
   * @return  Symmetric encryption key.
   */
  public SecretKey getKey()
  {
    return secretKey;
  }


  /**
   * Gets the initialization vector.
   *
   * @return  IV bytes.
   */
  public byte[] getIV()
  {
    return iv;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy