Example usage for javax.crypto.spec DESKeySpec DES_KEY_LEN

List of usage examples for javax.crypto.spec DESKeySpec DES_KEY_LEN

Introduction

In this page you can find the example usage for javax.crypto.spec DESKeySpec DES_KEY_LEN.

Prototype

int DES_KEY_LEN

To view the source code for javax.crypto.spec DESKeySpec DES_KEY_LEN.

Click Source Link

Document

The constant which defines the length of a DES key in bytes.

Usage

From source file:org.jboss.security.fips.utils.FIPSVaultOptions.java

/**
 * Validates that the initialization vector is a valid base-64 encoded
 * string with the expected length./*from w  w  w.j  a v  a 2 s. c o m*/
 * 
 * @param ivOptVal
 *            the initialization vector as a base-64 encoded string
 * @throws IllegalArgumentException
 *             if IV is missing, not a base-64 encoded value, or not correct
 *             length
 */
public void validateIvOption(String ivOptVal) throws IllegalArgumentException {
    if (ivOptVal == null)
        throw new IllegalArgumentException("missing required option " + IV);

    try {
        setIv(Base64Utils.fromb64(ivOptVal));
    } catch (NumberFormatException nfe) {
        throw new IllegalArgumentException("initialization vector is not a valid base-64 encoded byte array",
                nfe);
    }

    if (iv.length != DESKeySpec.DES_KEY_LEN)
        throw new IllegalArgumentException(
                "initialization vector must be " + DESKeySpec.DES_KEY_LEN + " bytes in length");
}