Class GPG


  • public class GPG
    extends Object
    This defines a GnuPG wrapper class.
    Since:
    25-02-2011
    Author:
    Samatar
    • Constructor Detail

      • GPG

        public GPG​(String gpgFilename,
                   org.pentaho.di.core.logging.LogChannelInterface logInterface)
            throws org.pentaho.di.core.exception.KettleException
        Constructs a new GnuPG
        Parameters:
        gpgFilename - gpg program location
        logInterface - LogChannelInterface
        Throws:
        org.pentaho.di.core.exception.KettleException
    • Method Detail

      • getGpgExeFile

        public String getGpgExeFile()
        Returns GPG program location
        Returns:
        GPG filename
      • decryptFile

        public void decryptFile​(org.apache.commons.vfs2.FileObject cryptedFilename,
                                String passPhrase,
                                org.apache.commons.vfs2.FileObject decryptedFilename)
                         throws org.pentaho.di.core.exception.KettleException
        Decrypt a file
        Parameters:
        cryptedFilename - crypted filename
        passPhrase - passphrase for the personal private key to sign with
        decryptedFilename - decrypted filename
        Throws:
        org.pentaho.di.core.exception.KettleException
      • decryptFile

        public void decryptFile​(String cryptedFilename,
                                String passPhrase,
                                String decryptedFilename)
                         throws org.pentaho.di.core.exception.KettleException
        Decrypt a file
        Parameters:
        cryptedFilename - crypted filename
        passPhrase - passphrase for the personal private key to sign with
        decryptedFilename - decrypted filename
        Throws:
        org.pentaho.di.core.exception.KettleException
      • encryptFile

        public void encryptFile​(org.apache.commons.vfs2.FileObject filename,
                                String userID,
                                org.apache.commons.vfs2.FileObject cryptedFilename,
                                boolean asciiMode)
                         throws org.pentaho.di.core.exception.KettleException
        Encrypt a file
        Parameters:
        filename - file to encrypt
        userID - specific user id key
        cryptedFilename - crypted filename
        asciiMode - output ASCII file
        Throws:
        org.pentaho.di.core.exception.KettleException
      • encryptFile

        public void encryptFile​(String filename,
                                String userID,
                                String cryptedFilename,
                                boolean asciiMode)
                         throws org.pentaho.di.core.exception.KettleException
        Encrypt a file
        Parameters:
        filename - file to encrypt
        userID - specific user id key
        cryptedFilename - crypted filename
        asciiMode - output ASCII file
        Throws:
        org.pentaho.di.core.exception.KettleException
      • signAndEncryptFile

        public void signAndEncryptFile​(org.apache.commons.vfs2.FileObject file,
                                       String userID,
                                       org.apache.commons.vfs2.FileObject cryptedFile,
                                       boolean asciiMode)
                                throws org.pentaho.di.core.exception.KettleException
        Sign and encrypt a file
        Parameters:
        file - file to encrypt
        userID - specific user id key
        cryptedFile - crypted filename
        asciiMode - output ASCII file
        Throws:
        org.pentaho.di.core.exception.KettleException
      • signAndEncryptFile

        public void signAndEncryptFile​(String filename,
                                       String userID,
                                       String cryptedFilename,
                                       boolean asciiMode)
                                throws org.pentaho.di.core.exception.KettleException
        Sign and encrypt a file
        Parameters:
        filename - file to encrypt
        userID - specific user id key
        cryptedFilename - crypted filename
        asciiMode - output ASCII file
        Throws:
        org.pentaho.di.core.exception.KettleException
      • signFile

        public void signFile​(String filename,
                             String userID,
                             String signedFilename,
                             boolean asciiMode)
                      throws org.pentaho.di.core.exception.KettleException
        Sign a file
        Parameters:
        filename - file to encrypt
        userID - specific user id key
        cryptedFilename - crypted filename
        asciiMode - output ASCII file
        Throws:
        org.pentaho.di.core.exception.KettleException
      • signFile

        public void signFile​(org.apache.commons.vfs2.FileObject file,
                             String userID,
                             org.apache.commons.vfs2.FileObject signedFile,
                             boolean asciiMode)
                      throws org.pentaho.di.core.exception.KettleException
        Sign a file
        Parameters:
        file - file to encrypt
        userID - specific user id key
        signedFile - crypted filename
        asciiMode - output ASCII file
        Throws:
        org.pentaho.di.core.exception.KettleException
      • verifySignature

        public void verifySignature​(org.apache.commons.vfs2.FileObject filename)
                             throws org.pentaho.di.core.exception.KettleException
        Verify a signature
        Parameters:
        filename - filename
        Throws:
        org.pentaho.di.core.exception.KettleException
      • verifySignature

        public void verifySignature​(String filename)
                             throws org.pentaho.di.core.exception.KettleException
        Verify a signature
        Parameters:
        filename - filename
        Throws:
        org.pentaho.di.core.exception.KettleException
      • verifyDetachedSignature

        public void verifyDetachedSignature​(String signatureFilename,
                                            String originalFilename)
                                     throws org.pentaho.di.core.exception.KettleException
        Verify a signature for detached file
        Parameters:
        signatureFilename - filename
        originalFilenamefill - this value in case of detached signature
        Throws:
        org.pentaho.di.core.exception.KettleException
      • verifyDetachedSignature

        public void verifyDetachedSignature​(org.apache.commons.vfs2.FileObject signatureFile,
                                            org.apache.commons.vfs2.FileObject originalFile)
                                     throws org.pentaho.di.core.exception.KettleException
        Verify a signature for detached file
        Parameters:
        signatureFile - filename
        originalFile - fill this value in case of detached signature
        Throws:
        org.pentaho.di.core.exception.KettleException
      • encrypt

        public String encrypt​(String plainText,
                              String keyID)
                       throws org.pentaho.di.core.exception.KettleException
        Encrypt a string
        Parameters:
        plainText - input string to encrypt
        keyID - key ID of the key in GnuPG's key database to encrypt with
        Returns:
        encrypted string
        Throws:
        org.pentaho.di.core.exception.KettleException
      • signAndEncrypt

        public String signAndEncrypt​(String plainText,
                                     String userID,
                                     String passPhrase)
                              throws org.pentaho.di.core.exception.KettleException
        Signs and encrypts a string
        Parameters:
        plainText - input string to encrypt
        userID - key ID of the key in GnuPG's key database to encrypt with
        passPhrase - passphrase for the personal private key to sign with
        Returns:
        encrypted string
        Throws:
        org.pentaho.di.core.exception.KettleException
      • sign

        public String sign​(String stringToSign,
                           String passPhrase)
                    throws org.pentaho.di.core.exception.KettleException
        Sign
        Parameters:
        stringToSign - input string to sign
        passPhrase - passphrase for the personal private key to sign with
        Throws:
        org.pentaho.di.core.exception.KettleException
      • decrypt

        public String decrypt​(String cryptedText,
                              String passPhrase)
                       throws org.pentaho.di.core.exception.KettleException
        Decrypt a string
        Parameters:
        cryptedText - input string to decrypt
        passPhrase - passphrase for the personal private key to sign with
        Returns:
        plain text
        Throws:
        org.pentaho.di.core.exception.KettleException