Package org.mozilla.jss.pkcs11
Class PK11SymKey
java.lang.Object
org.mozilla.jss.pkcs11.PK11SymKey
- All Implemented Interfaces:
Serializable,Key,SecretKey,Destroyable,SymmetricKey
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.mozilla.jss.crypto.SymmetricKey
SymmetricKey.NotExtractableException, SymmetricKey.Type, SymmetricKey.Usage -
Field Summary
FieldsFields inherited from interface javax.crypto.SecretKey
serialVersionUIDFields inherited from interface org.mozilla.jss.crypto.SymmetricKey
AES, DES, DES3, GENERIC_SECRET, RC2, RC4, SHA1_HMAC, SHA256_HMAC, SHA384_HMAC, SHA512_HMAC -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPK11SymKey(byte[] pointer) protectedPK11SymKey(byte[] pointer, String nickName) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]byte[]intReturns the length of the key in bytes, as returned by PK11_GetKeyLength().intReturns key strength, measured as the number of bits of secret material.getType()voidsetNickName(String nickName) voidsetNickNameNative(String nickName) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.security.auth.Destroyable
destroy, isDestroyed
-
Field Details
-
keyProxy
-
nickName
-
-
Constructor Details
-
PK11SymKey
protected PK11SymKey(byte[] pointer) -
PK11SymKey
-
-
Method Details
-
getType
- Specified by:
getTypein interfaceSymmetricKey
-
getOwningToken
- Specified by:
getOwningTokenin interfaceSymmetricKey
-
getStrength
public int getStrength()Returns key strength, measured as the number of bits of secret material. NOTE: Due to a bug in the security library (333440), this may return a wrong answer for PBE keys that have embedded parity (like DES). A DES key is 56 bits of information plus 8 bits of parity, so it takes up 64 bits. For a normal DES key, this method will correctly return 56, but for a PBE-generated DES key, the security library bug causes it to return 64.- Specified by:
getStrengthin interfaceSymmetricKey
-
getLength
public int getLength()Returns the length of the key in bytes, as returned by PK11_GetKeyLength().- Specified by:
getLengthin interfaceSymmetricKey
-
getKeyData
- Specified by:
getKeyDatain interfaceSymmetricKey- Throws:
SymmetricKey.NotExtractableException
-
getKeyType
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceKey- Specified by:
getAlgorithmin interfaceSymmetricKey
-
getEncoded
public byte[] getEncoded()- Specified by:
getEncodedin interfaceKey- Specified by:
getEncodedin interfaceSymmetricKey
-
getFormat
- Specified by:
getFormatin interfaceKey- Specified by:
getFormatin interfaceSymmetricKey
-
getNickName
- Specified by:
getNickNamein interfaceSymmetricKey
-
setNickName
- Specified by:
setNickNamein interfaceSymmetricKey
-
setNickNameNative
-