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

pack-priv final Class PBEKey

extends Object
implements SecretKey
Class Inheritance
All Implemented Interfaces
javax.crypto.SecretKey, javax.security.auth.Destroyable, java.security.Key, java.io.Serializable
Imports
java.io.IOException, .InvalidObjectException, java.lang.ref.Reference, .Cleaner.Cleanable, java.security.MessageDigest, .KeyRep, java.security.spec.InvalidKeySpecException, java.util.Arrays, .Locale, javax.crypto.SecretKey, javax.crypto.spec.PBEKeySpec, sun.security.util.PBEUtil, jdk.internal.ref.CleanerFactory

This class represents a PBE key.
Author
Jan Luehe

Field Summary

Modifier and TypeField and Description
private transient Cleaner.Cleanable
private byte[]
private static final long
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
PBEKey(PBEKeySpec keySpec, String
the given PBE key specification
keytype
)

Creates a PBE key from a given PBE key specification.

Method Summary

Modifier and TypeMethod and Description
public void
destroy()

Overrides default javax.security.auth.Destroyable.destroy.

Clears the internal copy of the key.

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

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

public String
getAlgorithm()

Implements java.security.Key.getAlgorithm.

Returns the standard algorithm name for this key.

public byte[]
getEncoded()

Implements java.security.Key.getEncoded.

Returns the key in its primary encoding format, or null if this key does not support encoding.

public String
getFormat()

Implements java.security.Key.getFormat.

Returns the name of the primary encoding format of this key, or null if this key does not support encoding.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Calculates a hash code value for the object.

public boolean
isDestroyed()

Overrides default javax.security.auth.Destroyable.isDestroyed.

Determine if this Object has been destroyed.

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
s
)

Restores the state of this object from the stream.

private Object

Returns:

the standard KeyRep object to be serialized
writeReplace
()

Replace the PBE key to be serialized.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

cleanableback to summary
private transient Cleaner.Cleanable cleanable
keyback to summary
private byte[] key
serialVersionUIDback to summary
private static final long serialVersionUID

Hides javax.crypto.SecretKey.serialVersionUID.

Annotations
@Serial
typeback to summary
private final String type

Constructor Detail

PBEKeyback to summary
pack-priv PBEKey(PBEKeySpec keySpec, String keytype) throws InvalidKeySpecException

Creates a PBE key from a given PBE key specification.

Parameters
keytype:String

the given PBE key specification

Method Detail

destroyback to summary
public void destroy()

Overrides default javax.security.auth.Destroyable.destroy.

Clears the internal copy of the key.

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

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

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

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getAlgorithmback to summary
public String getAlgorithm()

Implements java.security.Key.getAlgorithm.

Doc from java.security.Key.getAlgorithm.

Returns the standard algorithm name for this key. For example, "RSA" would indicate that this key is an RSA key. See the Key Algorithms section in the Java Security Standard Algorithm Names Specification for information about standard key algorithm names.

getEncodedback to summary
public byte[] getEncoded()

Implements java.security.Key.getEncoded.

Doc from java.security.Key.getEncoded.

Returns the key in its primary encoding format, or null if this key does not support encoding.

getFormatback to summary
public String getFormat()

Implements java.security.Key.getFormat.

Doc from java.security.Key.getFormat.

Returns the name of the primary encoding format of this key, or null if this key does not support encoding. The primary encoding format is named in terms of the appropriate ASN.1 data format, if an ASN.1 specification for this key exists. For example, the name of the ASN.1 data format for public keys is SubjectPublicKeyInfo, as defined by the X.509 standard; in this case, the returned format is "X.509". Similarly, the name of the ASN.1 data format for private keys is PrivateKeyInfo, as defined by the PKCS #8 standard; in this case, the returned format is "PKCS#8".

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Calculates a hash code value for the object. Objects that are equal will also have the same hashcode.

Annotations
@Override
isDestroyedback to summary
public boolean isDestroyed()

Overrides default javax.security.auth.Destroyable.isDestroyed.

Doc from javax.security.auth.Destroyable.isDestroyed.

Determine if this Object has been destroyed.

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

Restores the state of this object from the stream.

Parameters
s:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded
writeReplaceback to summary
private Object writeReplace() throws ObjectStreamException

Replace the PBE key to be serialized.

Returns:Object

the standard KeyRep object to be serialized

Annotations
@Serial
Exceptions
ObjectStreamException:
if a new object representing this PBE key could not be created