Class OpenSSHKeyFile

  • All Implemented Interfaces:
    FileKeyProvider, KeyProvider

    public class OpenSSHKeyFile
    extends PKCS8KeyFile
    Represents an OpenSSH identity that consists of a PKCS8-encoded private key file and an unencrypted public key file of the same name with the ".pub" extension. This allows to delay requesting of the passphrase until the private key is requested.
    See Also:
    PKCS8KeyFile
    • Field Detail

      • pubKey

        private java.security.PublicKey pubKey
    • Constructor Detail

      • OpenSSHKeyFile

        public OpenSSHKeyFile()
    • Method Detail

      • getPublic

        public java.security.PublicKey getPublic()
                                          throws java.io.IOException
        Specified by:
        getPublic in interface KeyProvider
        Overrides:
        getPublic in class BaseFileKeyProvider
        Returns:
        the public key.
        Throws:
        java.io.IOException - if there is an I/O error retrieving the public key
      • initPubKey

        private void initPubKey​(java.io.Reader publicKey)
                         throws java.io.IOException
        Read and store the separate public key provided alongside the private key
        Parameters:
        publicKey - Public key accessible through a Reader
        Throws:
        java.io.IOException