|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.crypto.spec.SecretKeySpec tribble.crypto.SymmetricKey
Symmetric block cipher key.
This base class provides the foundation for keys of cipher (encryption) algorithms having fixed-length blocks and key lengths and which utilize the same (symmetric, secret) initialization key for both encryption and decryption.
Note that none of these methods are synchronized.
Copyright ©2005 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code
provided that the original copyright and authorship notices remain
intact.
SymmetricCipher
,
BlockCipherSpi
,
Serialized FormField Summary |
Fields inherited from interface java.security.Key |
serialVersionUID |
Constructor Summary | |
SymmetricKey(byte[] key,
int off,
int len,
java.lang.String alg)
Constructor. |
|
SymmetricKey(byte[] key,
java.lang.String alg)
Constructor. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Determmine if this key is equal to another object. |
protected void |
finalize()
Finalization. |
java.lang.String |
getAlgorithm()
Retrieve the name of the cipher that uses this key. |
byte[] |
getEncoded()
Retrieve the raw contents of this key. |
int |
hashCode()
Determmine the hash code for this key. |
Methods inherited from class javax.crypto.spec.SecretKeySpec |
getFormat |
Methods inherited from class java.lang.Object |
clone, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.security.Key |
getFormat |
Constructor Detail |
public SymmetricKey(byte[] key, java.lang.String alg)
key
- Raw key contents.
A private copy of this array is made, so the contents of key
should be wiped after constructing this key in order to protect sensitive
information from lingering in memory.alg
- Name of the symmetric cipher algorithm associated with this key.public SymmetricKey(byte[] key, int off, int len, java.lang.String alg)
key
- Raw key contents.
A private copy of this array is made, so the contents of key
should be wiped after constructing this key in order to protect sensitive
information from lingering in memory.off
- Index of the first element in key comprising the key.len
- Number of elements in key comprising the key.alg
- Name of the symmetric cipher algorithm associated with this key.Method Detail |
public boolean equals(java.lang.Object obj)
obj
- Another object to compare this one to.
SymmetricKey
and is composed of the same
information as this key, otherwise false.public int hashCode()
public java.lang.String getAlgorithm()
getAlgorithm
in interface java.security.Key
public byte[] getEncoded()
getEncoded
in interface java.security.Key
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |