Class BCMLKEMPrivateKey

    • Constructor Detail

      • BCMLKEMPrivateKey

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

      • equals

        public boolean equals​(java.lang.Object o)
        Compare this ML-KEM private key with another object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the other object
        Returns:
        the result of the comparison
      • 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 - "ML-KEM"
      • getEncoded

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

        public byte[] getPrivateData()
        Description copied from interface: MLKEMPrivateKey
        Return the long form private data for the ML-KEM private key.
        Specified by:
        getPrivateData in interface MLKEMPrivateKey
        Returns:
        long form private data for private key.
      • getSeed

        public byte[] getSeed()
        Description copied from interface: MLKEMPrivateKey
        Return the seed the private key was generated from (if available).
        Specified by:
        getSeed in interface MLKEMPrivateKey
        Returns:
        the seed for the private key, null if not available.
      • getPrivateKey

        public MLKEMPrivateKey getPrivateKey​(boolean preferSeedOnly)
        Description copied from interface: MLKEMPrivateKey
        Return a privateKey which will encode as seed-only or as an expanded-key.
        Specified by:
        getPrivateKey in interface MLKEMPrivateKey
        Parameters:
        preferSeedOnly - if true, return a privateKey which will encode to seed-only if possible.
        Returns:
        a new MLKEMPrivateKey which encodes to either seed-only or expanded-key.
      • getFormat

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • destroy

        public void destroy()
        Destroy this key, zeroizing the secret key material it holds.

        After destruction isDestroyed() returns true and the secret-bearing accessors (such as getEncoded(), getPrivateData() and getSeed()) throw IllegalStateException. As the underlying parameter arrays may be shared with keys derived from this one, destruction invalidates those references too.

        Specified by:
        destroy in interface javax.security.auth.Destroyable
      • isDestroyed

        public boolean isDestroyed()
        Specified by:
        isDestroyed in interface javax.security.auth.Destroyable