Class CompositePrivateKey

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

    public class CompositePrivateKey
    extends java.lang.Object
    implements java.security.PrivateKey
    A composite private key class.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from interface java.security.PrivateKey

        serialVersionUID
    • Constructor Summary

      Constructors 
      Constructor Description
      CompositePrivateKey​(java.security.PrivateKey... keys)
      Create a composite private key from an array of PublicKeys.
      CompositePrivateKey​(ASN1ObjectIdentifier algorithmIdentifier, java.security.PrivateKey... keys)
      Create a composite private key which corresponds to a composite signature algorithm in algorithmIdentifier.
      CompositePrivateKey​(PrivateKeyInfo keyInfo)
      Create a composite private key from a PrivateKeyInfo.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.String getAlgorithm()  
      ASN1ObjectIdentifier getAlgorithmIdentifier()  
      byte[] getEncoded()
      Returns the encoding of the composite private key.
      java.lang.String getFormat()  
      java.util.List<java.security.PrivateKey> getPrivateKeys()
      Return a list of the component private keys making up this composite.
      int hashCode()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.security.auth.Destroyable

        destroy, isDestroyed
    • Constructor Detail

      • CompositePrivateKey

        public CompositePrivateKey​(java.security.PrivateKey... keys)
        Create a composite private key from an array of PublicKeys. This constructor is currently used only for legacy composites implementation.
        Parameters:
        keys - The component private keys.
      • CompositePrivateKey

        public CompositePrivateKey​(ASN1ObjectIdentifier algorithmIdentifier,
                                   java.security.PrivateKey... keys)
        Create a composite private key which corresponds to a composite signature algorithm in algorithmIdentifier. The component private keys are not checked if they satisfy the composite definition at this point, however, they will fail when they are fed into component algorithms which are defined by the algorithmIdentifier.
        Parameters:
        algorithmIdentifier -
        keys -
      • CompositePrivateKey

        public CompositePrivateKey​(PrivateKeyInfo keyInfo)
        Create a composite private key from a PrivateKeyInfo.
        Parameters:
        keyInfo - PrivateKeyInfo object containing a composite private key.
    • Method Detail

      • getPrivateKeys

        public java.util.List<java.security.PrivateKey> getPrivateKeys()
        Return a list of the component private keys making up this composite.
        Returns:
        an immutable list of private keys.
      • getAlgorithm

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

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

        public byte[] getEncoded()
        Returns the encoding of the composite private key. It is compliant with https://www.ietf.org/archive/id/draft-ounsworth-pq-composite-sigs-13.html#name-compositesignatureprivateke as each component is encoded as a PrivateKeyInfo (older name for OneAsymmetricKey).
        Specified by:
        getEncoded in interface java.security.Key
        Returns:
      • hashCode

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

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