Class PGPUtils


  • public final class PGPUtils
    extends java.lang.Object
    TODO Add javadoc
    • Field Detail

      • DEFAULT_PGP_FILE_SUFFIX

        public static final java.lang.String DEFAULT_PGP_FILE_SUFFIX
        See Also:
        Constant Field Values
      • STD_LINUX_PGP_FOLDER_NAME

        public static final java.lang.String STD_LINUX_PGP_FOLDER_NAME
        See Also:
        Constant Field Values
      • STD_WINDOWS_PGP_FOLDER_NAME

        public static final java.lang.String STD_WINDOWS_PGP_FOLDER_NAME
        See Also:
        Constant Field Values
      • PGP_ENCRYPTED_FILE

        public static final java.lang.String PGP_ENCRYPTED_FILE
        Default MIME type for PGP encrypted files
        See Also:
        Constant Field Values
      • NO_CIPHER_PLACEHOLDER

        public static final java.lang.String NO_CIPHER_PLACEHOLDER
        Alias for Unencrypted
        See Also:
        Constant Field Values
      • CIPHERS

        public static final java.util.Set<org.c02e.jpgpj.EncryptionAlgorithm> CIPHERS
      • NO_COMPRESSION_PLACEHOLDER

        public static final java.lang.String NO_COMPRESSION_PLACEHOLDER
        Alias for Uncompressed
        See Also:
        Constant Field Values
      • COMPRESSIONS

        public static final java.util.Set<org.c02e.jpgpj.CompressionAlgorithm> COMPRESSIONS
      • DEFAULT_PGP_PATH_RESOLVER_HOLDER

        private static final java.util.concurrent.atomic.AtomicReference<java.util.function.Supplier<? extends java.nio.file.Path>> DEFAULT_PGP_PATH_RESOLVER_HOLDER
    • Constructor Detail

      • PGPUtils

        private PGPUtils()
    • Method Detail

      • fromCipherName

        public static org.c02e.jpgpj.EncryptionAlgorithm fromCipherName​(java.lang.String name)
      • fromCompressionName

        public static org.c02e.jpgpj.CompressionAlgorithm fromCompressionName​(java.lang.String name)
      • mapSubKeysByFingerprint

        public static java.util.NavigableMap<java.lang.String,​org.c02e.jpgpj.Subkey> mapSubKeysByFingerprint​(org.c02e.jpgpj.Key key)
        Parameters:
        key - The Key whose sub-keys to map - ignored if null or no sub-keys available
        Returns:
        A NavigableMap where key=the (case insensitive) fingerprint value, value=the matching Subkey
        Throws:
        java.lang.NullPointerException - If key with null fingerprint encountered
        java.lang.IllegalArgumentException - If key with empty fingerprint encountered
        java.lang.IllegalStateException - If more than one key with same fingerprint found
        See Also:
        mapSubKeysByFingerprint(Collection)
      • mapSubKeysByFingerprint

        public static java.util.NavigableMap<java.lang.String,​org.c02e.jpgpj.Subkey> mapSubKeysByFingerprint​(java.util.Collection<? extends org.c02e.jpgpj.Subkey> subKeys)
        Parameters:
        subKeys - The Subkey-s to map - ignored if null/empty
        Returns:
        A NavigableMap where key=the (case insensitive) fingerprint value, value=the matching Subkey
        Throws:
        java.lang.NullPointerException - If key with null fingerprint encountered
        java.lang.IllegalArgumentException - If key with empty fingerprint encountered
        java.lang.IllegalStateException - If more than one key with same fingerprint found
      • findSubkeyByFingerprint

        public static org.c02e.jpgpj.Subkey findSubkeyByFingerprint​(org.c02e.jpgpj.Key key,
                                                                    java.lang.String fingerprint)
        Parameters:
        key - The Key whose sub-keys to scan - ignored if null or has no sub-keys
        fingerprint - The fingerprint to match (case insensitive) - ignored if null/empty
        Returns:
        The first matching Subkey - null if no match found
        See Also:
        findSubkeyByFingerprint(Collection, String)
      • findSubkeyByFingerprint

        public static org.c02e.jpgpj.Subkey findSubkeyByFingerprint​(java.util.Collection<? extends org.c02e.jpgpj.Subkey> subKeys,
                                                                    java.lang.String fingerprint)
        Parameters:
        subKeys - The Subkey-s to scan - ignored if null/empty
        fingerprint - The fingerprint to match (case insensitive) - ignored if null/empty
        Returns:
        The first matching sub-key - null if no match found
      • getDefaultPgpFolderPath

        public static java.nio.file.Path getDefaultPgpFolderPath()
        Returns:
        The default Gnu Privacy Guard folder used to hold key files.
      • setDefaultPgpFolderPathResolver

        public static void setDefaultPgpFolderPathResolver​(java.util.function.Supplier<? extends java.nio.file.Path> resolver)
        Set the reported value from getDefaultPgpFolderPath()
        Parameters:
        resolver - The Path provider to report - if null then O/S default value will be used