public class PESigner extends Object
| Constructor and Description |
|---|
PESigner(Certificate[] chain,
PrivateKey privateKey)
Create a PESigner with the specified certificate chain and private key.
|
PESigner(KeyStore keystore,
String alias,
String password)
Create a PESigner with a certificate chain and private key from the specified keystore.
|
| Modifier and Type | Method and Description |
|---|---|
void |
sign(PEFile file)
Sign the specified executable file.
|
PESigner |
withDigestAlgorithm(DigestAlgorithm algorithm)
Set the digest algorithm to use (SHA-256 by default)
|
PESigner |
withProgramName(String programName)
Set the program name embedded in the signature.
|
PESigner |
withProgramURL(String programURL)
Set the program URL embedded in the signature.
|
PESigner |
withSignatureAlgorithm(String signatureAlgorithm)
Explicitly sets the signature algorithm to use.
|
PESigner |
withSignatureAlgorithm(String signatureAlgorithm,
Provider signatureProvider)
Explicitly sets the signature algorithm and provider to use.
|
PESigner |
withSignatureAlgorithm(String signatureAlgorithm,
String signatureProvider)
Explicitly sets the signature algorithm and provider to use.
|
PESigner |
withSignatureProvider(Provider signatureProvider)
Set the signature provider to use.
|
PESigner |
withSignaturesReplaced(boolean replace)
Enable or disable the replacement of the previous signatures (disabled by default).
|
PESigner |
withTimestamper(Timestamper timestamper)
Set the Timestamper implementation.
|
PESigner |
withTimestamping(boolean timestamping)
Enable or disable the timestamping (enabled by default).
|
PESigner |
withTimestampingAuthority(String... url)
Set the URL of the timestamping authority.
|
PESigner |
withTimestampingAuthority(String url)
Set the URL of the timestamping authority.
|
PESigner |
withTimestampingMode(TimestampingMode tsmode)
RFC3161 or Authenticode (Authenticode by default).
|
PESigner |
withTimestampingRetries(int timestampingRetries)
Set the number of retries for timestamping.
|
PESigner |
withTimestampingRetryWait(int timestampingRetryWait)
Set the number of seconds to wait between timestamping retries.
|
public PESigner(Certificate[] chain, PrivateKey privateKey)
chain - the certificate chain. The first certificate is the signing certificateprivateKey - the private keyIllegalArgumentException - if the chain is emptypublic PESigner(KeyStore keystore, String alias, String password) throws NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException
keystore - the keystore holding the certificate and the private keyalias - the alias of the certificate in the keystorepassword - the password to get the private keyNoSuchAlgorithmExceptionKeyStoreExceptionUnrecoverableKeyExceptionpublic void sign(PEFile file) throws Exception
Exceptionpublic PESigner withDigestAlgorithm(DigestAlgorithm algorithm)
public PESigner withProgramName(String programName)
public PESigner withProgramURL(String programURL)
public PESigner withSignatureAlgorithm(String signatureAlgorithm)
public PESigner withSignatureAlgorithm(String signatureAlgorithm, Provider signatureProvider)
public PESigner withSignatureAlgorithm(String signatureAlgorithm, String signatureProvider)
public PESigner withSignatureProvider(Provider signatureProvider)
public PESigner withSignaturesReplaced(boolean replace)
public PESigner withTimestamper(Timestamper timestamper)
public PESigner withTimestamping(boolean timestamping)
public PESigner withTimestampingAuthority(String... url)
public PESigner withTimestampingAuthority(String url)
public PESigner withTimestampingMode(TimestampingMode tsmode)
public PESigner withTimestampingRetries(int timestampingRetries)
public PESigner withTimestampingRetryWait(int timestampingRetryWait)
Copyright © 2012–2019. All rights reserved.