Class PK11SymKey

  • All Implemented Interfaces:
    java.io.Serializable, java.security.Key, javax.crypto.SecretKey, javax.security.auth.Destroyable, SymmetricKey

    public final class PK11SymKey
    extends java.lang.Object
    implements SymmetricKey
    See Also:
    Serialized Form
    • Constructor Detail

      • PK11SymKey

        protected PK11SymKey​(byte[] pointer)
      • PK11SymKey

        protected PK11SymKey​(byte[] pointer,
                             java.lang.String nickName)
    • Method Detail

      • 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:
        getStrength in interface SymmetricKey
      • getLength

        public int getLength()
        Returns the length of the key in bytes, as returned by PK11_GetKeyLength().
        Specified by:
        getLength in interface SymmetricKey
      • getKeyType

        public KeyType getKeyType()
      • getAlgorithm

        public java.lang.String getAlgorithm()
        Specified by:
        getAlgorithm in interface java.security.Key
        Specified by:
        getAlgorithm in interface SymmetricKey
      • getEncoded

        public byte[] getEncoded()
        Specified by:
        getEncoded in interface java.security.Key
        Specified by:
        getEncoded in interface SymmetricKey
      • getFormat

        public java.lang.String getFormat()
        Specified by:
        getFormat in interface java.security.Key
        Specified by:
        getFormat in interface SymmetricKey
      • setNickName

        public void setNickName​(java.lang.String nickName)
        Specified by:
        setNickName in interface SymmetricKey
      • setNickNameNative

        public void setNickNameNative​(java.lang.String nickName)