}
return null;
}
public byte[] sign(byte[] originalBytes) {
KeyStoreConfig store = KeyStoreConfig.instance();
try {
InputStream is = FacesResources.getResourceAsStream( store.getKeyStore(), getFacesContext().getExternalContext() );
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(is, store.getKeyStorePassword().toCharArray());
PrivateKey key = (PrivateKey) ks.getKey(store.getKeyAlias(),
store.getKeyPassword().toCharArray());
Certificate[] chain = ks.getCertificateChain(store.getKeyAlias());
PdfReader reader = new PdfReader(originalBytes);
ByteArrayOutputStream os = new ByteArrayOutputStream();
PdfStamper stamper = PdfStamper.createSignature(reader, os, '\0');