public final class JkGpgSigner extends java.lang.Object implements JkSigner
Modifier and Type | Method and Description |
---|---|
static java.nio.file.Path |
getDefaultGpgSecretRingPath()
Returns the default path for the secret ring file.
|
java.nio.file.Path |
getSecretRingPath()
Returns the secret ring of this object.
|
static JkGpgSigner |
ofAsciiKey(java.lang.String asciiKey,
java.lang.String passphrase)
Creates a new instance of
JkGpgSigner with the specified ascii key and passphrase. |
static JkGpgSigner |
ofDefaultGnuPg(java.lang.String password,
java.lang.String keyName)
Creates a
JkGpgSigner with default GnuPgp file location. |
static JkGpgSigner |
ofSecretRing(java.nio.file.Path secRing,
java.lang.String password)
Creates a
JkGpgSigner with the specified secret key ring, assuming the secret ring
contains a single key. |
static JkGpgSigner |
ofSecretRing(java.nio.file.Path secRing,
java.lang.String passphrase,
java.lang.String keyName)
Creates a new instance of
JkGpgSigner with the specified secret ring, passphrase, and key name. |
static JkGpgSigner |
ofStandardProject(java.nio.file.Path baseDir)
Creates a
JkGpgSigner instance for a standard project. |
static JkGpgSigner |
ofStandardProperties()
Creates a new instance of
JkGpgSigner with the standard properties.Use jeka.gpg.secret-key property or JEKA_GPG_SECRET_KEY for passing private ascii key. |
void |
sign(java.io.InputStream streamToSign,
java.io.OutputStream signatureStream)
Signs the data in the specified input stream and writes the signature to the output stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sign
public static JkGpgSigner ofSecretRing(java.nio.file.Path secRing, java.lang.String passphrase, java.lang.String keyName)
JkGpgSigner
with the specified secret ring, passphrase, and key name.secRing
- the path to the secret ring filepassphrase
- the passphrase for the secret ring filekeyName
- the name of the key to use within the secret ring file.
Can be empty if secRing contains a single key.public static JkGpgSigner ofSecretRing(java.nio.file.Path secRing, java.lang.String password)
JkGpgSigner
with the specified secret key ring, assuming the secret ring
contains a single key.public static JkGpgSigner ofAsciiKey(java.lang.String asciiKey, java.lang.String passphrase)
JkGpgSigner
with the specified ascii key and passphrase.asciiKey
- The armored key to use for signing. It is generally by exporting key in asc formatpassphrase
- The passphrase for the armored key. The exported key is protected by a passphrase.
This is the passphrase to use for decoding the armored key.public static JkGpgSigner ofStandardProject(java.nio.file.Path baseDir)
JkGpgSigner
instance for a standard project.
This method creates a JkGpgSigner
instance using the specified base directory to locate
the public and secret ring files. If the public or secret ring files are not found in the
base directory, the default files will be used.
baseDir
- the base directory of the projectJkGpgSigner
instance for the standard projectpublic static JkGpgSigner ofStandardProperties()
JkGpgSigner
with the standard properties.jeka.gpg.secret-key
property or JEKA_GPG_SECRET_KEY
for passing private ascii key.
jeka.gpg.passphrase
property or EKA_GPG_PASSPHRASE
for passing key passwordpublic static JkGpgSigner ofDefaultGnuPg(java.lang.String password, java.lang.String keyName)
JkGpgSigner
with default GnuPgp file location.keyName
- Can be empty if secret ring contains a single key.public static java.nio.file.Path getDefaultGpgSecretRingPath()
public java.nio.file.Path getSecretRingPath()
public void sign(java.io.InputStream streamToSign, java.io.OutputStream signatureStream)
JkSigner