Package org.apache.sshd.openpgp
Class PGPUtils
- java.lang.Object
-
- org.apache.sshd.openpgp.PGPUtils
-
public final class PGPUtils extends java.lang.Object
TODO Add javadoc
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
PGPUtils.LazyDefaultPgpKeysFolderHolder
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<org.c02e.jpgpj.EncryptionAlgorithm>
CIPHERS
static java.util.Set<org.c02e.jpgpj.CompressionAlgorithm>
COMPRESSIONS
static java.lang.String
DEFAULT_PGP_FILE_SUFFIX
private static java.util.concurrent.atomic.AtomicReference<java.util.function.Supplier<? extends java.nio.file.Path>>
DEFAULT_PGP_PATH_RESOLVER_HOLDER
static java.lang.String
NO_CIPHER_PLACEHOLDER
Alias forUnencrypted
static java.lang.String
NO_COMPRESSION_PLACEHOLDER
Alias forUncompressed
static java.lang.String
PGP_ENCRYPTED_FILE
Default MIME type for PGP encrypted filesstatic java.lang.String
STD_LINUX_PGP_FOLDER_NAME
static java.lang.String
STD_WINDOWS_PGP_FOLDER_NAME
-
Constructor Summary
Constructors Modifier Constructor Description private
PGPUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.c02e.jpgpj.Subkey
findSubkeyByFingerprint(java.util.Collection<? extends org.c02e.jpgpj.Subkey> subKeys, java.lang.String fingerprint)
static org.c02e.jpgpj.Subkey
findSubkeyByFingerprint(org.c02e.jpgpj.Key key, java.lang.String fingerprint)
static org.c02e.jpgpj.EncryptionAlgorithm
fromCipherName(java.lang.String name)
static org.c02e.jpgpj.CompressionAlgorithm
fromCompressionName(java.lang.String name)
static java.nio.file.Path
getDefaultPgpFolderPath()
static java.util.NavigableMap<java.lang.String,org.c02e.jpgpj.Subkey>
mapSubKeysByFingerprint(java.util.Collection<? extends org.c02e.jpgpj.Subkey> subKeys)
static java.util.NavigableMap<java.lang.String,org.c02e.jpgpj.Subkey>
mapSubKeysByFingerprint(org.c02e.jpgpj.Key key)
static void
setDefaultPgpFolderPathResolver(java.util.function.Supplier<? extends java.nio.file.Path> resolver)
Set the reported value fromgetDefaultPgpFolderPath()
-
-
-
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 forUnencrypted
- 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 forUncompressed
- 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
-
-
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
- TheKey
whose sub-keys to map - ignored ifnull
or no sub-keys available- Returns:
- A
NavigableMap
where key=the (case insensitive) fingerprint value, value=the matchingSubkey
- Throws:
java.lang.NullPointerException
- If key withnull
fingerprint encounteredjava.lang.IllegalArgumentException
- If key with empty fingerprint encounteredjava.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
- TheSubkey
-s to map - ignored ifnull
/empty- Returns:
- A
NavigableMap
where key=the (case insensitive) fingerprint value, value=the matchingSubkey
- Throws:
java.lang.NullPointerException
- If key withnull
fingerprint encounteredjava.lang.IllegalArgumentException
- If key with empty fingerprint encounteredjava.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
- TheKey
whose sub-keys to scan - ignored ifnull
or has no sub-keysfingerprint
- The fingerprint to match (case insensitive) - ignored ifnull
/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
- TheSubkey
-s to scan - ignored ifnull
/emptyfingerprint
- The fingerprint to match (case insensitive) - ignored ifnull
/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 fromgetDefaultPgpFolderPath()
- Parameters:
resolver
- ThePath
provider to report - ifnull
then O/S default value will be used
-
-