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[] password)
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,
TSAClient tsaClient)
Signs the given PDF file.
|
void |
signDetached(PDDocument document,
OutputStream output,
TSAClient tsaClient) |
protected org.bouncycastle.cms.CMSSignedData |
signTimeStamps(org.bouncycastle.cms.CMSSignedData signedData)
We just extend CMS signed Data
|
getTsaClient, setCertificate, setPrivateKey, setTsaClient, sign
public CreateSignature(KeyStore keystore, char[] password) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException
keystore
- the keystore containing the signing certificatepassword
- 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 wrongpublic 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, TSAClient tsaClient) throws IOException
inFile
- input PDF fileoutFile
- output PDF filetsaClient
- optional TSA clientIOException
- if the input file could not be readpublic void signDetached(PDDocument document, OutputStream output, TSAClient tsaClient) throws IOException
IOException
protected org.bouncycastle.cms.CMSSignedData signTimeStamps(org.bouncycastle.cms.CMSSignedData signedData) throws IOException, org.bouncycastle.tsp.TSPException
signTimeStamps
in class CreateSignatureBase
signedData
- -Generated CMS signed dataIOException
org.bouncycastle.tsp.TSPException
public static void main(String[] args) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.