gnu.javax.crypto.kwa
Class BaseKeyWrappingAlgorithm
- IKeyWrappingAlgorithm
A base class to facilitate implementation of concrete Key Wrapping
Algorithms.
protected String | name - The canonical name of the key wrapping algorithm.
|
protected abstract void | engineInit(Map<K,V> attributes)
|
protected abstract byte[] | engineUnwrap(byte[] in, int inOffset, int length)
|
protected abstract byte[] | engineWrap(byte[] in, int inOffset, int length)
|
protected PRNG | getDefaultPRNG()
|
void | init(Map<K,V> attributes) - Initializes this instance with the designated algorithm specific
attributes.
|
String | name() - Returns the canonical name of this Key Wrapping Algorithm.
|
byte[] | unwrap(byte[] in, int inOffset, int length) - Unwraps the designated cipher text bytes.
|
int | unwrap(byte[] in, int inOffset, int length, byte[] out, int outOffset) - Unwraps the designated cipher text bytes.
|
byte[] | wrap(byte[] in, int inOffset, int length) - Wraps the designated plain text bytes.
|
int | wrap(byte[] in, int inOffset, int length, byte[] out, int outOffset) - Wraps the designated plain text bytes.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
name
protected String name
The canonical name of the key wrapping algorithm.
engineWrap
protected abstract byte[] engineWrap(byte[] in,
int inOffset,
int length)
getDefaultPRNG
protected PRNG getDefaultPRNG()
- a strong pseudo-random number generator if/when needed.
init
public void init(Map<K,V> attributes)
throws InvalidKeyException
Initializes this instance with the designated algorithm specific
attributes.
- init in interface IKeyWrappingAlgorithm
attributes
- a map of name-to-value pairs the Key Wrapping Algorithm
must use for its setup.
InvalidKeyException
- if an exception is encountered while seting up
the Key Wrapping Algorithm keying material (KEK).
unwrap
public byte[] unwrap(byte[] in,
int inOffset,
int length)
throws KeyUnwrappingException
Unwraps the designated cipher text bytes.
- unwrap in interface IKeyWrappingAlgorithm
in
- the input byte array containing the cipher text.inOffset
- the offset into in
where the first byte of
the cipher text (already wrapped key material) to unwrap is
located.length
- the number of bytes to unwrap.
- a newly allocated byte array containing the plain text.
KeyUnwrappingException
- if after unwrapping the cipher text, the
bytes at the begining did not match the initial value.
unwrap
public int unwrap(byte[] in,
int inOffset,
int length,
byte[] out,
int outOffset)
throws ShortBufferException,
KeyUnwrappingException
Unwraps the designated cipher text bytes.
- unwrap in interface IKeyWrappingAlgorithm
in
- the input byte array containing the cipher text.inOffset
- the offset into in
where the first byte of
the cipher text (already wrapped key material) to unwrap is
located.length
- the number of bytes to unwrap.out
- the output byte array where the unwrapped key material will be
stored.outOffset
- the offset into out
of the first unwrapped
byte.
- the number of bytes of the unwrapped key material; i.e. the length,
in
out
, starting from outOffset
where the plain text (unwrapped key material) are stored.
ShortBufferException
- if the output buffer is not long enough to
accomodate the number of bytes resulting from unwrapping the
cipher text.KeyUnwrappingException
- if after unwrapping the cipher text, the
bytes at the begining did not match the initial value.
wrap
public byte[] wrap(byte[] in,
int inOffset,
int length)
Wraps the designated plain text bytes.
- wrap in interface IKeyWrappingAlgorithm
in
- the input byte array containing the plain text.inOffset
- the offset into in
where the first byte of
the plain text (key material) to wrap is located.length
- the number of bytes to wrap.
- a newly allocated byte array containing the cipher text.
wrap
public int wrap(byte[] in,
int inOffset,
int length,
byte[] out,
int outOffset)
throws ShortBufferException
Wraps the designated plain text bytes.
- wrap in interface IKeyWrappingAlgorithm
in
- the input byte array containing the plain text.inOffset
- the offset into in
where the first byte of
the plain text (key material) to wrap is located.length
- the number of bytes to wrap.out
- the output byte array where the wrapped key material will be
stored.outOffset
- the offset into out
of the first wrapped
byte.
- the number of bytes of the wrapped key material; i.e. the length,
in
out
, starting from outOffset
where the cipher text (wrapped key material) are stored.
ShortBufferException
- if the output buffer is not long enough to
accomodate the number of bytes resulting from wrapping the plain
text.
BaseKeyWrappingAlgorithm.java -- FIXME: briefly describe file purpose
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.