com.ibm.crypto.fips.provider

Class CipherWithWrappingSpi

  1. java.lang.Object
  2. extended byjavax.crypto.CipherSpi
  3. extended bycom.ibm.crypto.fips.provider.CipherWithWrappingSpi
All implemented interfaces:
AlgorithmStatus

  1. public abstract class CipherWithWrappingSpi
  2. extends javax.crypto.CipherSpi
  3. implements AlgorithmStatus
This class entends the javax.crypto.CipherSpi class with a concrete implementation of the methods for wrapping and unwrapping keys.
Version:
1.1, 07/28/99
Author:
Sharon Liu
See Also:
CipherSpi, DESCipher

Constructor Summary

Constructor and Description
CipherWithWrappingSpi()

Method Summary

Modifier and Type Method and Description
  1. protected
  2. java.security.Key
engineUnwrap(byte[] wrappedKey,java.lang.String wrappedKeyAlgorithm,int wrappedKeyType)
Unwrap a previously wrapped key.
  1. protected
  2. byte[]
engineWrap(java.security.Key key)
Wrap a key.
  1. protected
  2. java.security.Key
internalUnwrap(byte[] wrappedKey,java.lang.String wrappedKeyAlgorithm,int wrappedKeyType)
Unwrap a previously wrapped key.
  1. protected
  2. byte[]
internalWrap(java.security.Key key)
Wrap a key.
  1. boolean
isFipsApproved()
Methods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetKeySize, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUpdate, engineUpdate, engineUpdate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

CipherWithWrappingSpi

  1. public CipherWithWrappingSpi()

Method Detail

isFipsApproved

  1. public boolean isFipsApproved()
Description copied from interface: AlgorithmStatus
Module identifies if the cryptographic operation (algorithm) is FIPS certified
Specified by:
See Also:

engineWrap

  1. protected final byte[] engineWrap( java.security.Key key)
  2. throws javax.crypto.IllegalBlockSizeException
  3. java.security.InvalidKeyException
Wrap a key.
Overrides:
engineWrap in class javax.crypto.CipherSpi
Parameters:
key - the key to be wrapped.
Returns:
the wrapped key.
Throws:
javax.crypto.IllegalBlockSizeException - if this cipher is a block cipher, no padding has been requested, and the length of the encoding of the key to be wrapped is not a multiple of the block size.
java.security.InvalidKeyException - if it is impossible or unsafe to wrap the key with this cipher (e.g., a hardware protected key is being passed to a software only cipher).
FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.

internalWrap

  1. protected final byte[] internalWrap( java.security.Key key)
  2. throws javax.crypto.IllegalBlockSizeException
  3. java.security.InvalidKeyException
Wrap a key.
Parameters:
key - the key to be wrapped.
Returns:
the wrapped key.
Throws:
javax.crypto.IllegalBlockSizeException - if this cipher is a block cipher, no padding has been requested, and the length of the encoding of the key to be wrapped is not a multiple of the block size.
java.security.InvalidKeyException - if it is impossible or unsafe to wrap the key with this cipher (e.g., a hardware protected key is being passed to a software only cipher).

engineUnwrap

  1. protected final java.security.Key engineUnwrap( byte[] wrappedKey,
  2. java.lang.String wrappedKeyAlgorithm,
  3. int wrappedKeyType)
  4. throws java.security.InvalidKeyException
  5. java.security.NoSuchAlgorithmException
Unwrap a previously wrapped key.
Overrides:
engineUnwrap in class javax.crypto.CipherSpi
Parameters:
wrappedKey - the key to be unwrapped.
wrappedKeyAlgorithm - the algorithm the wrapped key is for.
wrappedKeyType - the type of the wrapped key. This is one of Cipher.SECRET_KEY, Cipher.PRIVATE_KEY, or Cipher.PUBLIC_KEY.
Returns:
the unwrapped key.
Throws:
java.security.InvalidKeyException - if wrappedKey does not represent a wrapped key, or if the algorithm associated with the wrapped key is different from wrappedKeyAlgorithm and/or its key type is different from wrappedKeyType.
java.security.NoSuchAlgorithmException - if no installed providers can create keys for the wrappedKeyAlgorithm.
FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.

internalUnwrap

  1. protected final java.security.Key internalUnwrap( byte[] wrappedKey,
  2. java.lang.String wrappedKeyAlgorithm,
  3. int wrappedKeyType)
  4. throws java.security.InvalidKeyException
  5. java.security.NoSuchAlgorithmException
Unwrap a previously wrapped key.
Parameters:
wrappedKey - the key to be unwrapped.
wrappedKeyAlgorithm - the algorithm the wrapped key is for.
wrappedKeyType - the type of the wrapped key. This is one of Cipher.SECRET_KEY, Cipher.PRIVATE_KEY, or Cipher.PUBLIC_KEY.
Returns:
the unwrapped key.
Throws:
java.security.InvalidKeyException - if wrappedKey does not represent a wrapped key, or if the algorithm associated with the wrapped key is different from wrappedKeyAlgorithm and/or its key type is different from wrappedKeyType.
java.security.NoSuchAlgorithmException - if no installed providers can create keys for the wrappedKeyAlgorithm.