public class CreateSignature extends CreateSignatureBase
keytool -genkeypair -storepass 123456 -storetype pkcs12 -alias test -validity 365
-v -keyalg RSA -keystore keystore.p12
Constructor and Description |
---|
CreateSignature(KeyStore keystore,
char[] pin)
Initialize the signature creator with a keystore and certficate password.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args) |
void |
signDetached(File file)
Signs the given PDF file.
|
void |
signDetached(File inFile,
File outFile)
Signs the given PDF file.
|
void |
signDetached(File inFile,
File outFile,
String tsaUrl)
Signs the given PDF file.
|
void |
signDetached(PDDocument document,
OutputStream output) |
isExternalSigning, setCertificateChain, setExternalSigning, setPrivateKey, setTsaUrl, sign
public CreateSignature(KeyStore keystore, char[] pin) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, IOException
keystore
- the pkcs12 keystore containing the signing certificatepin
- the password for recovering the keyKeyStoreException
- if the keystore has not been initialized (loaded)NoSuchAlgorithmException
- if the algorithm for recovering the key cannot be foundUnrecoverableKeyException
- if the given password is wrongCertificateException
- if the certificate is not valid as signing timeIOException
- if no certificate could be foundpublic void signDetached(File file) throws IOException
file
- the PDF file to signIOException
- if the file could not be read or writtenpublic void signDetached(File inFile, File outFile) throws IOException
inFile
- input PDF fileoutFile
- output PDF fileIOException
- if the input file could not be readpublic void signDetached(File inFile, File outFile, String tsaUrl) throws IOException
inFile
- input PDF fileoutFile
- output PDF filetsaUrl
- optional TSA urlIOException
- if the input file could not be readpublic void signDetached(PDDocument document, OutputStream output) throws IOException
IOException
public static void main(String[] args) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.