Class BCHawkPrivateKey

  • All Implemented Interfaces:
    java.io.Serializable, java.security.Key, java.security.PrivateKey, javax.security.auth.Destroyable, HawkKey

    public class BCHawkPrivateKey
    extends java.lang.Object
    implements java.security.PrivateKey, HawkKey
    JCA private key wrapper for Hawk. Round-trips through PKCS#8 PrivateKeyInfo via the lightweight PrivateKeyFactory. Equality uses Arrays.constantTimeAreEqual(byte[], byte[]) on the encoded private key bytes to avoid leaking secret material through timing-distinguishable comparisons.
    See Also:
    Serialized Form
    • Constructor Detail

      • BCHawkPrivateKey

        public BCHawkPrivateKey​(PrivateKeyInfo keyInfo)
                         throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getAlgorithm

        public final java.lang.String getAlgorithm()
        Specified by:
        getAlgorithm in interface java.security.Key
        Returns:
        name of the algorithm - upper-case form of the Hawk parameter-set name
      • getEncoded

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

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