Methods Summary |
---|
protected void | finalize()Frees the references to the key used to initialize this instance.
initKey = null;
|
public final byte[] | genExemptionBlob()Generates the result key blob for this exemption mechanism.
if (!isInit) {
throw new IllegalStateException(Messages.getString("crypto.2D"));
}
generated = false;
byte[] result = spiImpl.engineGenExemptionBlob();
generated = true;
return result;
|
public final int | genExemptionBlob(byte[] output)Generates the result key blob for this exemption mechanism and stores it
into the {@code output} buffer.
return genExemptionBlob(output, 0);
|
public final int | genExemptionBlob(byte[] output, int outputOffset)Generates the result key blob for this exemption mechanism and stores it
into the {@code output} buffer at offset {@code outputOffset}.
if (!isInit) {
throw new IllegalStateException(Messages.getString("crypto.2D"));
}
generated = false;
int len = spiImpl.engineGenExemptionBlob(output, outputOffset);
generated = true;
return len;
|
public static final javax.crypto.ExemptionMechanism | getInstance(java.lang.String algorithm)Returns a new {@code ExemptionMechanism} instance that provides the
specified exemption mechanism algorithm.
if (algorithm == null) {
throw new NullPointerException(Messages.getString("crypto.02")); //$NON-NLS-1$
}
synchronized (engine) {
engine.getInstance(algorithm, null);
return new ExemptionMechanism((ExemptionMechanismSpi) engine.spi,
engine.provider, algorithm);
}
|
public static final javax.crypto.ExemptionMechanism | getInstance(java.lang.String algorithm, java.lang.String provider)Returns a new {@code ExemptionMechansm} instance that provides the
specified exemption mechanism algorithm from the specified provider.
if (provider == null) {
throw new IllegalArgumentException(Messages.getString("crypto.04")); //$NON-NLS-1$
}
Provider impProvider = Security.getProvider(provider);
if (impProvider == null) {
throw new NoSuchProviderException(provider);
}
if (algorithm == null) {
throw new NullPointerException(Messages.getString("crypto.02")); //$NON-NLS-1$
}
return getInstance(algorithm, impProvider);
|
public static final javax.crypto.ExemptionMechanism | getInstance(java.lang.String algorithm, java.security.Provider provider)Returns a new {@code ExemptionMechanism} instance that provides the
specified exemption mechanism algorithm from the specified provider.
if (algorithm == null) {
throw new NullPointerException(Messages.getString("crypto.02")); //$NON-NLS-1$
}
if (provider == null) {
throw new IllegalArgumentException(Messages.getString("crypto.04")); //$NON-NLS-1$
}
synchronized (engine) {
engine.getInstance(algorithm, provider, null);
return new ExemptionMechanism((ExemptionMechanismSpi) engine.spi,
provider, algorithm);
}
|
public final java.lang.String | getName()Returns the name of this {@code ExemptionMechanism}.
return mechanism;
|
public final int | getOutputSize(int inputLen)Returns the size in bytes for the output buffer needed to hold the output
of the next {@link #genExemptionBlob} call, given the specified {@code
inputLen} (in bytes).
if (!isInit) {
throw new IllegalStateException(Messages.getString("crypto.2D"));
}
return spiImpl.engineGetOutputSize(inputLen);
|
public final java.security.Provider | getProvider()Returns the provider of this {@code ExemptionMechanism} instance.
return provider;
|
public final void | init(java.security.Key key, java.security.AlgorithmParameters param)Initializes this {@code ExemptionMechanism} instance with the
specified key and algorithm parameters.
generated = false;
spiImpl.engineInit(key, param);
initKey = key;
isInit = true;
|
public final void | init(java.security.Key key, java.security.spec.AlgorithmParameterSpec param)Initializes this {@code ExemptionMechanism} instance with the
specified key and algorithm parameters.
generated = false;
spiImpl.engineInit(key, param);
initKey = key;
isInit = true;
|
public final void | init(java.security.Key key)Initializes this {@code ExemptionMechanism} instance with the
specified key.
generated = false;
spiImpl.engineInit(key);
initKey = key;
isInit = true;
|
public final boolean | isCryptoAllowed(java.security.Key key)Returns whether the result blob for this {@code ExemptionMechanism}
instance has been generated successfully and that the specified key is
the same as the one that was used to initialize and generate.
if (generated
&& (initKey.equals(key) || Arrays.equals(initKey.getEncoded(),
key.getEncoded()))) {
return true;
}
return false;
|