APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.crypto.provider

pack-priv final Class PKCS12PBECipherCore

extends Object
Class Inheritance
Imports
java.io.Closeable, .IOException, java.security.*, java.security.spec.*, java.util.Arrays, javax.crypto.*, javax.crypto.spec.*, javax.security.auth.DestroyFailedException

This class implements password-base encryption algorithm with SHA1 digest and the following Ciphers (in CBC mode, where applicable): - DESede cipher and - RC2 Cipher with 40-bit or 128-bit effective key length and - RC4 Cipher with 40-bit or 128-bit effective key length as defined by PKCS #12 version 1.0 standard.
Author
Valerie Peng
See Also
javax.crypto.CipherSpi

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record
public static class
pack-priv static class
public static class
public static class
pack-priv static class
public static class
public static class

Field Summary

Modifier and TypeField and Description
private final String
pack-priv static final int
pack-priv static final int
pack-priv static final int
private static final int
private int
private final int
pack-priv static final int
private final String
private byte[]

Constructor Summary

AccessConstructor and Description
pack-priv
PKCS12PBECipherCore(String symmCipherAlg, int keySizeInBits)

Method Summary

Modifier and TypeMethod and Description
private static void
addOne(int len, byte[] b)

private static void
addTwo(int len, byte[] src, byte[] dst, int offset)

private static void
concat(byte[] src, byte[] dst, int start, int len)

pack-priv static byte[]
derive(char[] chars, byte[] salt, int ic, int n, int type)

pack-priv static byte[]
derive(char[] chars, byte[] salt, int ic, int n, int type, String hashAlgo, int blockLength)

pack-priv int
pack-priv AlgorithmParameters
pack-priv PKCS12PBECipherCore.KeyAndIv
implInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random)

private static int
roundup(int x, int y)

private static final PBEParameterSpec
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

algoback to summary
private final String algo
CIPHER_IVback to summary
pack-priv static final int CIPHER_IV
CIPHER_KEYback to summary
pack-priv static final int CIPHER_KEY
DEFAULT_COUNTback to summary
pack-priv static final int DEFAULT_COUNT
DEFAULT_SALT_LENGTHback to summary
private static final int DEFAULT_SALT_LENGTH
iCountback to summary
private int iCount
keySizeback to summary
private final int keySize
MAC_KEYback to summary
pack-priv static final int MAC_KEY
pbeAlgoback to summary
private final String pbeAlgo
saltback to summary
private byte[] salt

Constructor Detail

PKCS12PBECipherCoreback to summary
pack-priv PKCS12PBECipherCore(String symmCipherAlg, int keySizeInBits) throws NoSuchAlgorithmException

Method Detail

addOneback to summary
private static void addOne(int len, byte[] b)
addTwoback to summary
private static void addTwo(int len, byte[] src, byte[] dst, int offset)
concatback to summary
private static void concat(byte[] src, byte[] dst, int start, int len)
deriveback to summary
pack-priv static byte[] derive(char[] chars, byte[] salt, int ic, int n, int type)
deriveback to summary
pack-priv static byte[] derive(char[] chars, byte[] salt, int ic, int n, int type, String hashAlgo, int blockLength)
implGetKeySizeback to summary
pack-priv int implGetKeySize(Key key) throws InvalidKeyException
implGetParametersback to summary
pack-priv AlgorithmParameters implGetParameters()
implInitback to summary
pack-priv PKCS12PBECipherCore.KeyAndIv implInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException
roundupback to summary
private static int roundup(int x, int y)
toParamSpecback to summary
private static final PBEParameterSpec toParamSpec(AlgorithmParameters ap) throws InvalidAlgorithmParameterException
com.sun.crypto.provider back to summary

private final Record PKCS12PBECipherCore.KeyAndIv

extends Record
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Record Components
key:SecretKey 
iv:IvParameterSpec 

Field Summary

Modifier and TypeField and Description
private final IvParameterSpec
iv

Record Component accessed by iv().

private final SecretKey
key

Record Component accessed by key().

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public IvParameterSpec
iv()

Record Component getter of iv.

public SecretKey
key()

Record Component getter of key.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

ivback to summary
private final IvParameterSpec iv

Record Component accessed by iv().

keyback to summary
private final SecretKey key

Record Component accessed by key().

Constructor Detail

KeyAndIvback to summary
private KeyAndIv(SecretKey key, IvParameterSpec iv)

Method Detail

closeback to summary
public void close()

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

ivback to summary
public IvParameterSpec iv()

Record Component getter of iv.

keyback to summary
public SecretKey key()

Record Component getter of key.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

com.sun.crypto.provider back to summary

public final Class PKCS12PBECipherCore.PBEWithSHA1AndDESede

extends DESedeCipher
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final PKCS12PBECipherCore

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected int
engineGetKeySize(Key key)

Overrides com.sun.crypto.provider.DESedeCipher.engineGetKeySize.

Returns the key size of the given key object.

protected AlgorithmParameters
engineGetParameters()

Overrides com.sun.crypto.provider.DESedeCipher.engineGetParameters.

Returns the parameters used with this cipher.

protected void
engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random)

Overrides com.sun.crypto.provider.DESedeCipher.engineInit.

Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.

protected void
engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random)

Overrides com.sun.crypto.provider.DESedeCipher.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

protected void
engineInit(int opmode, Key key, SecureRandom random)

Overrides com.sun.crypto.provider.DESedeCipher.engineInit.

Initializes this cipher with a key and a source of randomness.

protected void
engineSetMode(String mode)

Overrides com.sun.crypto.provider.DESedeCipher.engineSetMode.

Sets the mode of this cipher.

protected void
engineSetPadding(String paddingScheme)

Overrides com.sun.crypto.provider.DESedeCipher.engineSetPadding.

Sets the padding mechanism of this cipher.

Inherited from com.sun.crypto.provider.DESedeCipher:
engineDoFinalengineDoFinalengineGetBlockSizeengineGetIVengineGetOutputSizeengineUnwrapengineUpdateengineUpdateengineWrap

Field Detail

coreback to summary
private final PKCS12PBECipherCore core

Hides com.sun.crypto.provider.DESedeCipher.core.

Constructor Detail

PBEWithSHA1AndDESedeback to summary
public PBEWithSHA1AndDESede() throws NoSuchAlgorithmException

Method Detail

engineGetKeySizeback to summary
protected int engineGetKeySize(Key key) throws InvalidKeyException

Overrides com.sun.crypto.provider.DESedeCipher.engineGetKeySize.

Doc from com.sun.crypto.provider.DESedeCipher.engineGetKeySize.

Returns the key size of the given key object.

Annotations
@Override
Exceptions
InvalidKeyException:
if key is invalid.
engineGetParametersback to summary
protected AlgorithmParameters engineGetParameters()

Overrides com.sun.crypto.provider.DESedeCipher.engineGetParameters.

Doc from com.sun.crypto.provider.DESedeCipher.engineGetParameters.

Returns the parameters used with this cipher.

The returned parameters may be the same that were used to initialize this cipher, or may contain the default set of parameters or a set of randomly generated parameters used by the underlying cipher implementation (provided that the underlying cipher implementation uses a default set of parameters or creates new parameters if it needs parameters but was not initialized with any).

Annotations
@Override
engineInitback to summary
protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException

Overrides com.sun.crypto.provider.DESedeCipher.engineInit.

Doc from com.sun.crypto.provider.DESedeCipher.engineInit.

Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.

The cipher is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher (including its underlying feedback or padding scheme) requires any random bytes, it will get them from random.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
InvalidAlgorithmParameterException:
if the given algorithm parameters are inappropriate for this cipher
engineInitback to summary
protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException

Overrides com.sun.crypto.provider.DESedeCipher.engineInit.

Doc from javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

The CipherSpi object is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters and params is null, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidAlgorithmParameterException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using engineGetParameters or engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a CipherSpi object is initialized, it loses all previously-acquired state. In other words, initializing a CipherSpi object is equivalent to creating a new instance of that CipherSpi object and initializing it.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
InvalidAlgorithmParameterException:
if the given algorithm parameters are inappropriate for this cipher, or if this cipher requires algorithm parameters and params is null
engineInitback to summary
protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException

Overrides com.sun.crypto.provider.DESedeCipher.engineInit.

Doc from com.sun.crypto.provider.DESedeCipher.engineInit.

Initializes this cipher with a key and a source of randomness.

The cipher is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires an initialization vector (IV), it will get it from random. This behaviour should only be used in encryption or key wrapping mode, however. When initializing a cipher that requires an IV for decryption or key unwrapping, the IV (same IV that was used for encryption or key wrapping) must be provided explicitly as a parameter, in order to get the correct result.

This method also cleans existing buffer and other related state information.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
engineSetModeback to summary
protected void engineSetMode(String mode) throws NoSuchAlgorithmException

Overrides com.sun.crypto.provider.DESedeCipher.engineSetMode.

Doc from com.sun.crypto.provider.DESedeCipher.engineSetMode.

Sets the mode of this cipher.

Annotations
@Override
Exceptions
NoSuchAlgorithmException:
if the requested cipher mode does not exist
engineSetPaddingback to summary
protected void engineSetPadding(String paddingScheme) throws NoSuchPaddingException

Overrides com.sun.crypto.provider.DESedeCipher.engineSetPadding.

Doc from com.sun.crypto.provider.DESedeCipher.engineSetPadding.

Sets the padding mechanism of this cipher.

Annotations
@Override
Exceptions
NoSuchPaddingException:
if the requested padding mechanism does not exist
com.sun.crypto.provider back to summary

pack-priv sealed Class PKCS12PBECipherCore.PBEWithSHA1AndRC2

extends RC2Cipher
permits PBEWithSHA1AndRC2_40, PBEWithSHA1AndRC2_128
Class Inheritance
Known Direct Subclasses
com.sun.crypto.provider.PKCS12PBECipherCore.PBEWithSHA1AndRC2_40, com.sun.crypto.provider.PKCS12PBECipherCore.PBEWithSHA1AndRC2_128

Field Summary

Modifier and TypeField and Description
private final PKCS12PBECipherCore

Constructor Summary

AccessConstructor and Description
public
PBEWithSHA1AndRC2(int keysize)

Method Summary

Modifier and TypeMethod and Description
protected AlgorithmParameters
engineGetParameters()

Overrides com.sun.crypto.provider.RC2Cipher.engineGetParameters.

Returns the parameters used with this cipher.

protected void
engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random)

Overrides com.sun.crypto.provider.RC2Cipher.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

protected void
engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random)

Overrides com.sun.crypto.provider.RC2Cipher.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

protected void
engineInit(int opmode, Key key, SecureRandom random)

Overrides com.sun.crypto.provider.RC2Cipher.engineInit.

Initializes this CipherSpi object with a key and a source of randomness.

protected void
engineSetMode(String mode)

Overrides com.sun.crypto.provider.RC2Cipher.engineSetMode.

Sets the mode of this cipher.

protected void
engineSetPadding(String paddingScheme)

Overrides com.sun.crypto.provider.RC2Cipher.engineSetPadding.

Sets the padding mechanism of this cipher.

Inherited from com.sun.crypto.provider.RC2Cipher:
engineDoFinalengineDoFinalengineGetBlockSizeengineGetIVengineGetKeySizeengineGetOutputSizeengineUnwrapengineUpdateengineUpdateengineWrap

Field Detail

coreback to summary
private final PKCS12PBECipherCore core

Hides com.sun.crypto.provider.RC2Cipher.core.

Constructor Detail

PBEWithSHA1AndRC2back to summary
public PBEWithSHA1AndRC2(int keysize) throws NoSuchAlgorithmException

Method Detail

engineGetParametersback to summary
protected AlgorithmParameters engineGetParameters()

Overrides com.sun.crypto.provider.RC2Cipher.engineGetParameters.

Doc from javax.crypto.CipherSpi.engineGetParameters.

Returns the parameters used with this cipher.

The returned parameters may be the same that were used to initialize this cipher, or may contain additional default or random parameter values used by the underlying cipher implementation. If the required parameters were not supplied and can be generated by the cipher, the generated parameters are returned. Otherwise, null is returned.

Annotations
@Override
engineInitback to summary
protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException

Overrides com.sun.crypto.provider.RC2Cipher.engineInit.

Doc from javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

The CipherSpi object is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters and params is null, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidAlgorithmParameterException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using engineGetParameters or engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a CipherSpi object is initialized, it loses all previously-acquired state. In other words, initializing a CipherSpi object is equivalent to creating a new instance of that CipherSpi object and initializing it.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
InvalidAlgorithmParameterException:
if the given algorithm parameters are inappropriate for this cipher, or if this cipher requires algorithm parameters and params is null
engineInitback to summary
protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException

Overrides com.sun.crypto.provider.RC2Cipher.engineInit.

Doc from javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

The CipherSpi object is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters and params is null, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidAlgorithmParameterException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using engineGetParameters or engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a CipherSpi object is initialized, it loses all previously-acquired state. In other words, initializing a CipherSpi object is equivalent to creating a new instance of that CipherSpi object and initializing it.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
InvalidAlgorithmParameterException:
if the given algorithm parameters are inappropriate for this cipher, or if this cipher requires algorithm parameters and params is null
engineInitback to summary
protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException

Overrides com.sun.crypto.provider.RC2Cipher.engineInit.

Doc from javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key and a source of randomness.

The CipherSpi object is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters that cannot be derived from the given key, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidKeyException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using engineGetParameters or engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a CipherSpi object is initialized, it loses all previously-acquired state. In other words, initializing a CipherSpi object is equivalent to creating a new instance of that CipherSpi object and initializing it.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher, or requires algorithm parameters that cannot be determined from the given key
engineSetModeback to summary
protected void engineSetMode(String mode) throws NoSuchAlgorithmException

Overrides com.sun.crypto.provider.RC2Cipher.engineSetMode.

Doc from javax.crypto.CipherSpi.engineSetMode.

Sets the mode of this cipher.

Annotations
@Override
Exceptions
NoSuchAlgorithmException:
if the requested cipher mode does not exist
engineSetPaddingback to summary
protected void engineSetPadding(String paddingScheme) throws NoSuchPaddingException

Overrides com.sun.crypto.provider.RC2Cipher.engineSetPadding.

Doc from javax.crypto.CipherSpi.engineSetPadding.

Sets the padding mechanism of this cipher.

Annotations
@Override
Exceptions
NoSuchPaddingException:
if the requested padding mechanism does not exist
com.sun.crypto.provider back to summary

public final Class PKCS12PBECipherCore.PBEWithSHA1AndRC2_128

extends PBEWithSHA1AndRC2
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from com.sun.crypto.provider.PKCS12PBECipherCore.PBEWithSHA1AndRC2:
engineGetParametersengineInitengineInitengineInitengineSetModeengineSetPadding

Constructor Detail

PBEWithSHA1AndRC2_128back to summary
public PBEWithSHA1AndRC2_128() throws NoSuchAlgorithmException
com.sun.crypto.provider back to summary

public final Class PKCS12PBECipherCore.PBEWithSHA1AndRC2_40

extends PBEWithSHA1AndRC2
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from com.sun.crypto.provider.PKCS12PBECipherCore.PBEWithSHA1AndRC2:
engineGetParametersengineInitengineInitengineInitengineSetModeengineSetPadding

Constructor Detail

PBEWithSHA1AndRC2_40back to summary
public PBEWithSHA1AndRC2_40() throws NoSuchAlgorithmException
com.sun.crypto.provider back to summary

pack-priv sealed Class PKCS12PBECipherCore.PBEWithSHA1AndRC4

extends ARCFOURCipher
permits PBEWithSHA1AndRC4_40, PBEWithSHA1AndRC4_128
Class Inheritance
Known Direct Subclasses
com.sun.crypto.provider.PKCS12PBECipherCore.PBEWithSHA1AndRC4_40, com.sun.crypto.provider.PKCS12PBECipherCore.PBEWithSHA1AndRC4_128

Field Summary

Modifier and TypeField and Description
private final PKCS12PBECipherCore

Constructor Summary

AccessConstructor and Description
public
PBEWithSHA1AndRC4(int keysize)

Method Summary

Modifier and TypeMethod and Description
protected int
engineGetKeySize(Key key)

Overrides com.sun.crypto.provider.ARCFOURCipher.engineGetKeySize.

Returns the key size of the given key object in bits.

protected AlgorithmParameters
engineGetParameters()

Overrides com.sun.crypto.provider.ARCFOURCipher.engineGetParameters.

Returns the parameters used with this cipher.

protected void
engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random)

Overrides com.sun.crypto.provider.ARCFOURCipher.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

protected void
engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random)

Overrides com.sun.crypto.provider.ARCFOURCipher.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

protected void
engineInit(int opmode, Key key, SecureRandom random)

Overrides com.sun.crypto.provider.ARCFOURCipher.engineInit.

Initializes this CipherSpi object with a key and a source of randomness.

protected void
engineSetMode(String mode)

Overrides com.sun.crypto.provider.ARCFOURCipher.engineSetMode.

Sets the mode of this cipher.

protected void
engineSetPadding(String paddingScheme)

Overrides com.sun.crypto.provider.ARCFOURCipher.engineSetPadding.

Sets the padding mechanism of this cipher.

Inherited from com.sun.crypto.provider.ARCFOURCipher:
engineDoFinalengineDoFinalengineGetBlockSizeengineGetIVengineGetOutputSizeengineUnwrapengineUpdateengineUpdateengineWrap

Field Detail

coreback to summary
private final PKCS12PBECipherCore core

Constructor Detail

PBEWithSHA1AndRC4back to summary
public PBEWithSHA1AndRC4(int keysize) throws NoSuchAlgorithmException

Method Detail

engineGetKeySizeback to summary
protected int engineGetKeySize(Key key) throws InvalidKeyException

Overrides com.sun.crypto.provider.ARCFOURCipher.engineGetKeySize.

Doc from javax.crypto.CipherSpi.engineGetKeySize.

Returns the key size of the given key object in bits.

This concrete method has been added to this previously-defined abstract class. It throws an UnsupportedOperationException if it is not overridden by the provider.

Annotations
@Override
Exceptions
InvalidKeyException:
if key is invalid
engineGetParametersback to summary
protected AlgorithmParameters engineGetParameters()

Overrides com.sun.crypto.provider.ARCFOURCipher.engineGetParameters.

Doc from javax.crypto.CipherSpi.engineGetParameters.

Returns the parameters used with this cipher.

The returned parameters may be the same that were used to initialize this cipher, or may contain additional default or random parameter values used by the underlying cipher implementation. If the required parameters were not supplied and can be generated by the cipher, the generated parameters are returned. Otherwise, null is returned.

Annotations
@Override
engineInitback to summary
protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException

Overrides com.sun.crypto.provider.ARCFOURCipher.engineInit.

Doc from javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

The CipherSpi object is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters and params is null, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidAlgorithmParameterException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using engineGetParameters or engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a CipherSpi object is initialized, it loses all previously-acquired state. In other words, initializing a CipherSpi object is equivalent to creating a new instance of that CipherSpi object and initializing it.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
InvalidAlgorithmParameterException:
if the given algorithm parameters are inappropriate for this cipher, or if this cipher requires algorithm parameters and params is null
engineInitback to summary
protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException

Overrides com.sun.crypto.provider.ARCFOURCipher.engineInit.

Doc from javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key, a set of algorithm parameters, and a source of randomness.

The CipherSpi object is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters and params is null, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidAlgorithmParameterException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using engineGetParameters or engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a CipherSpi object is initialized, it loses all previously-acquired state. In other words, initializing a CipherSpi object is equivalent to creating a new instance of that CipherSpi object and initializing it.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
InvalidAlgorithmParameterException:
if the given algorithm parameters are inappropriate for this cipher, or if this cipher requires algorithm parameters and params is null
engineInitback to summary
protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException

Overrides com.sun.crypto.provider.ARCFOURCipher.engineInit.

Doc from javax.crypto.CipherSpi.engineInit.

Initializes this CipherSpi object with a key and a source of randomness.

The CipherSpi object is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters that cannot be derived from the given key, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidKeyException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using engineGetParameters or engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a CipherSpi object is initialized, it loses all previously-acquired state. In other words, initializing a CipherSpi object is equivalent to creating a new instance of that CipherSpi object and initializing it.

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher, or requires algorithm parameters that cannot be determined from the given key
engineSetModeback to summary
protected void engineSetMode(String mode) throws NoSuchAlgorithmException

Overrides com.sun.crypto.provider.ARCFOURCipher.engineSetMode.

Doc from javax.crypto.CipherSpi.engineSetMode.

Sets the mode of this cipher.

Annotations
@Override
Exceptions
NoSuchAlgorithmException:
if the requested cipher mode does not exist
engineSetPaddingback to summary
protected void engineSetPadding(String paddingScheme) throws NoSuchPaddingException

Overrides com.sun.crypto.provider.ARCFOURCipher.engineSetPadding.

Doc from javax.crypto.CipherSpi.engineSetPadding.

Sets the padding mechanism of this cipher.

Annotations
@Override
Exceptions
NoSuchPaddingException:
if the requested padding mechanism does not exist
com.sun.crypto.provider back to summary

public final Class PKCS12PBECipherCore.PBEWithSHA1AndRC4_128

extends PBEWithSHA1AndRC4
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from com.sun.crypto.provider.PKCS12PBECipherCore.PBEWithSHA1AndRC4:
engineGetKeySizeengineGetParametersengineInitengineInitengineInitengineSetModeengineSetPadding

Constructor Detail

PBEWithSHA1AndRC4_128back to summary
public PBEWithSHA1AndRC4_128() throws NoSuchAlgorithmException
com.sun.crypto.provider back to summary

public final Class PKCS12PBECipherCore.PBEWithSHA1AndRC4_40

extends PBEWithSHA1AndRC4
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from com.sun.crypto.provider.PKCS12PBECipherCore.PBEWithSHA1AndRC4:
engineGetKeySizeengineGetParametersengineInitengineInitengineInitengineSetModeengineSetPadding

Constructor Detail

PBEWithSHA1AndRC4_40back to summary
public PBEWithSHA1AndRC4_40() throws NoSuchAlgorithmException