├── .github ├── dependabot.yml └── workflows │ ├── codeql-analysis.yml │ ├── do-release.yml │ ├── doc-builder.yaml │ ├── pr-builder.yaml │ └── push-snapshots.yaml ├── .gitignore ├── License.md ├── README.md ├── distribution ├── bin │ └── jsignpdf.sh ├── conf │ ├── conf.properties │ └── pkcs11.cfg ├── doc │ ├── ChangeLog.txt │ ├── ReleaseNotes.txt │ └── icon │ │ ├── Certificate.ico │ │ ├── icons.ico │ │ ├── icons.xcf │ │ ├── iconverticons.com │ │ ├── favicon_16x16.ico │ │ ├── favicon_32x32.ico │ │ ├── signedpdf.hqx │ │ ├── signedpdf.icns │ │ ├── signedpdf.ico │ │ ├── signedpdf_128x128x32.png │ │ ├── signedpdf_16x16x32.png │ │ ├── signedpdf_32x32x32.png │ │ └── signedpdf_48x48x32.png │ │ ├── jsignpdf_ncblue.png │ │ ├── jsignpdf_ncblue.xcf │ │ ├── logojsignpdf.png │ │ ├── logojsignpdf.xcf │ │ ├── misc.ico │ │ ├── signedpdf.png │ │ ├── signedpdf.xcf │ │ ├── signedpdf_notext.png │ │ ├── splash08.bmp │ │ ├── splash08.xcf │ │ ├── splash_1.0.0.bmp │ │ └── splash_1.0.0.xcf ├── images │ ├── signedpdf16.png │ └── signedpdf26.png ├── licenses │ ├── MPL-2.0.txt │ ├── ThirdPartyLicenses │ │ ├── DejaVu-font.license │ │ ├── InstallCert.license │ │ ├── PdfRenderer.license │ │ ├── apache-commons.license │ │ ├── bouncycastle.license │ │ ├── icu4j.license │ │ ├── pdfbox.license │ │ ├── pokrytie_font.license │ │ └── splashscreen.info │ └── lgpl-2.1.txt ├── pom.xml ├── src │ └── assembly │ │ └── assembly.xml └── windows │ ├── JSignPdf.iss │ ├── ant-build-create-launchers.xml │ ├── create-jsignpdf-installer.sh │ └── launch4j-template.l4j.ini ├── installcert ├── pom.xml └── src │ └── main │ └── java │ └── net │ └── sf │ └── jsignpdf │ └── InstallCert.java ├── jsignpdf ├── pom.xml └── src │ ├── main │ ├── java │ │ └── net │ │ │ └── sf │ │ │ └── jsignpdf │ │ │ ├── BasicSignerOptions.java │ │ │ ├── Constants.java │ │ │ ├── JSignEncryptor.java │ │ │ ├── JTextAreaHandler.java │ │ │ ├── JavaVersion.java │ │ │ ├── PdfExtraInfo.java │ │ │ ├── PrivateKeyInfo.java │ │ │ ├── SignPdfForm.form │ │ │ ├── SignPdfForm.java │ │ │ ├── SignResultListener.java │ │ │ ├── Signer.java │ │ │ ├── SignerFileChooser.java │ │ │ ├── SignerLogic.java │ │ │ ├── SignerOptionsFromCmdLine.java │ │ │ ├── TsaDialog.form │ │ │ ├── TsaDialog.java │ │ │ ├── UncompressPdf.java │ │ │ ├── VisibleSignatureDialog.form │ │ │ ├── VisibleSignatureDialog.java │ │ │ ├── crl │ │ │ └── CRLInfo.java │ │ │ ├── extcsp │ │ │ ├── CloudFoxy.java │ │ │ └── IExternalCryptoProvider.java │ │ │ ├── preview │ │ │ ├── FinalPropertyChangeSupport.java │ │ │ ├── Pdf2Image.java │ │ │ └── SelectionImage.java │ │ │ ├── ssl │ │ │ ├── DynamicX509TrustManager.java │ │ │ └── SSLInitializer.java │ │ │ ├── types │ │ │ ├── CertificationLevel.java │ │ │ ├── HashAlgorithm.java │ │ │ ├── PDFEncryption.java │ │ │ ├── PageInfo.java │ │ │ ├── PdfVersion.java │ │ │ ├── PrintRight.java │ │ │ ├── RelRect.java │ │ │ ├── RenderMode.java │ │ │ └── ServerAuthentication.java │ │ │ └── utils │ │ │ ├── ConfigProvider.java │ │ │ ├── ConvertUtils.java │ │ │ ├── FontUtils.java │ │ │ ├── GuiUtils.java │ │ │ ├── IOUtils.java │ │ │ ├── KeyStoreUtils.java │ │ │ ├── PKCS11Utils.java │ │ │ ├── PdfUtils.java │ │ │ ├── PropertyProvider.java │ │ │ └── ResourceProvider.java │ └── resources │ │ ├── logging.properties │ │ └── net │ │ └── sf │ │ └── jsignpdf │ │ ├── back16.png │ │ ├── clock16.png │ │ ├── fileopen16.png │ │ ├── fonts │ │ ├── DejaVuSans.ttf │ │ └── pokrytie.ttf │ │ ├── next16.png │ │ ├── options16.png │ │ ├── prev16.png │ │ ├── preview16.png │ │ ├── refresh16.png │ │ ├── security16.png │ │ ├── signedpdf16.png │ │ ├── signedpdf26.png │ │ ├── signedpdf32.png │ │ └── translations │ │ ├── messages.properties │ │ ├── messages_cs.properties │ │ ├── messages_de.properties │ │ ├── messages_el.properties │ │ ├── messages_es.properties │ │ ├── messages_fr.properties │ │ ├── messages_hr.properties │ │ ├── messages_hy.properties │ │ ├── messages_it.properties │ │ ├── messages_ja.properties │ │ ├── messages_nb-NO.properties │ │ ├── messages_pl.properties │ │ ├── messages_pt.properties │ │ ├── messages_ru.properties │ │ ├── messages_sk.properties │ │ └── messages_ta.properties │ └── test │ ├── java │ └── net │ │ └── sf │ │ └── jsignpdf │ │ ├── TestConstants.java │ │ └── utils │ │ └── KeyStoreUtilsTest.java │ └── resources │ ├── test-keystore.jks │ └── test-keystore.p12 ├── pom.xml ├── sample.properties └── website ├── .gitignore ├── README.md ├── babel.config.js ├── blog ├── 2023-08-10-switch-to-docusaurus.md └── authors.yml ├── docs ├── JSignPdf.adoc └── img │ ├── advanced-view.png │ ├── cert-level.png │ ├── hash-algorithm.png │ ├── installcert-tool.png │ ├── jsignpdf-header.png │ ├── keystore-types.png │ ├── output-console-window.png │ ├── preview-select.png │ ├── rights.png │ ├── simple-view.png │ ├── tsa-settings.png │ └── visible-dialog.png ├── docusaurus.config.js ├── package-lock.json ├── package.json ├── sidebars.js ├── src ├── components │ └── HomepageFeatures │ │ ├── index.js │ │ └── styles.module.css ├── css │ └── custom.css └── pages │ ├── index.js │ ├── index.module.css │ └── markdown-page.md └── static ├── .nojekyll └── img ├── alarm-clock.svg ├── java-icon.svg ├── jsignpdf-social-card.jpg ├── jsignpdf-social-card.xcf ├── preview.svg ├── signedpdf.png └── terminal.svg /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "maven" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | 13 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | # pull_request: 18 | # The branches below must be a subset of the branches above 19 | # branches: [ master ] 20 | # schedule: 21 | # - cron: '43 15 * * 2' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'java' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v4 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v1 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v1 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v1 72 | -------------------------------------------------------------------------------- /.github/workflows/do-release.yml: -------------------------------------------------------------------------------- 1 | name: Do Release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | release-version: 7 | description: 'Version to be released (e.g. 2.3.0).' 8 | required: true 9 | next-snapshot-version: 10 | description: 'Version to be set after the release - without the -SNAPSHOT suffix (e.g. 2.4.0).' 11 | required: true 12 | 13 | env: 14 | GIT_AUTHOR_NAME: Flash Gordon 15 | GIT_AUTHOR_EMAIL: <> 16 | GIT_COMMITTER_NAME: Terminator the Kitty 17 | GIT_COMMITTER_EMAIL: <> 18 | jobs: 19 | do-release: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: Checkout 23 | uses: actions/checkout@v4 24 | - name: Set up Java and credentials 25 | uses: actions/setup-java@v4 26 | with: 27 | java-version: 8 28 | distribution: 'adopt' 29 | server-id: ossrh 30 | server-username: MAVEN_USERNAME 31 | server-password: MAVEN_PASSWORD 32 | gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} 33 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 34 | cache: 'maven' 35 | 36 | - name: Do the Deployment and related stuff 37 | id: maven_release 38 | run: | 39 | VERSION=${{ github.event.inputs.release-version }} 40 | FULL_VERSION="JSignPdf-$VERSION" 41 | NEXT_VERSION=${{ github.event.inputs.next-snapshot-version }}-SNAPSHOT 42 | TAG=JSignPdf_${VERSION//\./_} 43 | set -x 44 | mvn clean install 45 | mvn -P release --batch-mode "-Dtag=${TAG}" release:prepare \ 46 | "-DreleaseVersion=${VERSION}" \ 47 | "-DdevelopmentVersion=${NEXT_VERSION}" 48 | mvn -P release --batch-mode release:perform \ 49 | -DstagingProgressTimeoutMinutes=30 -Dmaven.wagon.rto=7200000 \ 50 | -Dmaven.wagon.httpconnectionManager.maxPerRoute=60 -Dmaven.wagon.httpconnectionManager.maxTotal=100 51 | docker run --rm -v "$(pwd):/mnt" \ 52 | -u $(id -u):$(id -g) kwart/innosetup \ 53 | /mnt/distribution/windows/create-jsignpdf-installer.sh 54 | cd distribution/target 55 | ls -R 56 | mkdir "JSignPdf-$VERSION" 57 | mv *.zip *.exe "$FULL_VERSION/" 58 | cp generated-docs/JSignPdf.pdf "$FULL_VERSION/$FULL_VERSION.pdf" 59 | cp ../doc/ReleaseNotes.txt "$FULL_VERSION/README.txt" 60 | 61 | echo "${{ secrets.SSH_PRIVATE_KEY }}" >> private_key 62 | chmod 600 private_key 63 | sftp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i private_key kwart@frs.sourceforge.net:/home/frs/project/jsignpdf/stable <> $GITHUB_OUTPUT 69 | env: 70 | MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} 71 | MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} 72 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} 73 | 74 | - name: Upload binaries to release 75 | uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd 76 | with: 77 | file: distribution/target/upload/* 78 | file_glob: true 79 | tag: ${{ steps.maven_release.outputs.TAG }} 80 | overwrite: true 81 | -------------------------------------------------------------------------------- /.github/workflows/doc-builder.yaml: -------------------------------------------------------------------------------- 1 | name: Docusaurus build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - website/** 9 | - .github/workflows/doc-builder.yaml 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 14 | permissions: 15 | contents: read 16 | pages: write 17 | id-token: write 18 | 19 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 20 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 21 | concurrency: 22 | group: "pages" 23 | cancel-in-progress: false 24 | 25 | jobs: 26 | build: 27 | runs-on: ubuntu-latest 28 | steps: 29 | - uses: actions/checkout@v4 30 | - uses: actions/setup-node@v3 31 | with: 32 | node-version: 18 33 | - name: Generate MarkDown version of the Guide 34 | run: | 35 | cd website 36 | npm i downdoc 37 | npx downdoc -o docs/guide.md docs/JSignPdf.adoc 38 | npm run build 39 | - uses: actions/configure-pages@v5 40 | - uses: actions/upload-pages-artifact@v3 41 | with: 42 | path: 'website/build' 43 | 44 | # Deployment job 45 | deploy: 46 | environment: 47 | name: github-pages 48 | url: ${{ steps.deployment.outputs.page_url }} 49 | runs-on: ubuntu-latest 50 | needs: build 51 | steps: 52 | - name: Deploy to GitHub Pages 53 | id: deployment 54 | uses: actions/deploy-pages@v4 55 | -------------------------------------------------------------------------------- /.github/workflows/pr-builder.yaml: -------------------------------------------------------------------------------- 1 | name: Java CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Set up JDK 8 18 | uses: actions/setup-java@v4 19 | with: 20 | java-version: '8' 21 | distribution: 'adopt' 22 | - name: Build with Maven 23 | run: mvn --batch-mode --update-snapshots verify 24 | -------------------------------------------------------------------------------- /.github/workflows/push-snapshots.yaml: -------------------------------------------------------------------------------- 1 | name: Deploy snapshots 2 | 3 | # see https://docs.github.com/en/actions/guides/publishing-java-packages-with-maven 4 | 5 | on: 6 | push: 7 | branches: 8 | - master 9 | 10 | jobs: 11 | release: 12 | name: Release on Sonatype OSS 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Set up Java and credentials 18 | uses: actions/setup-java@v4 19 | with: 20 | java-version: 8 21 | distribution: 'adopt' 22 | server-id: ossrh 23 | server-username: MAVEN_USERNAME 24 | server-password: MAVEN_PASSWORD 25 | gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} 26 | gpg-passphrase: MAVEN_GPG_PASSPHRASE 27 | cache: 'maven' 28 | - name: Publish to Apache Maven Central 29 | run: | 30 | PROJECT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) 31 | if [[ "$PROJECT_VERSION" == *-SNAPSHOT ]]; then 32 | mvn --batch-mode -Prelease deploy 33 | else 34 | mvn --batch-mode package 35 | fi 36 | env: 37 | MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} 38 | MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} 39 | MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} 40 | 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Package Files # 4 | *.jar 5 | *.war 6 | *.ear 7 | *.zip 8 | 9 | nbproject/private 10 | Output 11 | build 12 | out 13 | out 14 | .idea 15 | **/*.iml 16 | 17 | target/ 18 | .settings 19 | .classpath 20 | .project 21 | 22 | jsignpdf/conf/ 23 | dependency-reduced-pom.xml 24 | guide.md 25 | -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | ### Mozilla Public License Version 2.0 2 | 3 | Please see [MPL-2.0.txt](distribution/licenses/MPL-2.0.txt). 4 | 5 | ### GNU Lesser General Public License 2.1 6 | 7 | Please see [lgpl-2.1.txt](distribution/licenses/lgpl-2.1.txt). 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JSignPdf 2 | 3 | [![Download JSignPdf](https://img.shields.io/sourceforge/dm/jsignpdf.svg)](https://sourceforge.net/projects/jsignpdf/files/latest/download) 4 | 5 | Project home-page: [intoolswetrust.github.io/jsignpdf/](https://intoolswetrust.github.io/jsignpdf/) 6 | 7 | JSignPdf is a Java application which adds digital signatures to PDF documents. 8 | The application uses the OpenPDF library for PDF manipulations. 9 | 10 | ## Translations 11 | Help to translate the project on Weblate platform: https://hosted.weblate.org/projects/jsignpdf/messages/ 12 | 13 | ## Build 14 | 15 | Use Apache Maven to build the project: 16 | 17 | ```bash 18 | mvn clean install 19 | ``` 20 | 21 | Resulting bits are located in the `distribution/target` 22 | 23 | ### Windows installer 24 | 25 | ```bash 26 | docker pull kwart/innosetup 27 | docker run -it --rm -v "$(pwd):/mnt" \ 28 | -u $(id -u):$(id -g) kwart/innosetup \ 29 | /mnt/distribution/windows/create-jsignpdf-installer.sh 30 | ``` 31 | 32 | ## Deploy/Release 33 | 34 | ### Deploy snapshots 35 | 36 | ``` 37 | mvn clean install deploy 38 | ``` 39 | 40 | ### Release 41 | 42 | * update files in `docs`: 43 | * ChangeLog.txt (`git log --since="2023-08-13" --pretty=format:'%ad: %s' --date=short`) 44 | * ReleaseNotes.txt 45 | * build the `jsignpdf` 46 | 47 | ```bash 48 | mvn -P release --batch-mode -Dtag=JSignPdf_2_0_0 release:prepare \ 49 | -DreleaseVersion=2.0.0 \ 50 | -DdevelopmentVersion=2.1.0-SNAPSHOT 51 | 52 | mvn -P release --batch-mode release:perform 53 | 54 | # and build the Windows installers too 55 | cd target/checkout 56 | docker pull kwart/innosetup 57 | docker run -it --rm -v "$(pwd):/mnt" \ 58 | -u $(id -u):$(id -g) kwart/innosetup \ 59 | /mnt/distribution/windows/create-jsignpdf-installer.sh 60 | 61 | # copy the bits to a new subdirectory in sftp://@frs.sourceforge.net/home/frs/project/jsignpdf 62 | # update version in sftp://@frs.sourceforge.net/home/project-web/jsignpdf/htdocs 63 | 64 | ``` 65 | 66 | ## Random 67 | 68 | ### Testing PKCS11 without a card reader 69 | 70 | *Note: This only works with PKCS11 keystore type. The JSignPKCS11 doesn't support the NSS keystores!* 71 | 72 | Use NSS keystore 73 | 74 | ```bash 75 | echo "pass123+" > /tmp/newpass.txt 76 | echo "dsadasdasdasdadasdasdasdasdsadfwerwerjfdksdjfksdlfhjsdk" > /tmp/noise.txt 77 | mkdir /tmp/nssdb 78 | MODUTIL_CMD="modutil -force -dbdir /tmp/nssdb" 79 | $MODUTIL_CMD -create 80 | $MODUTIL_CMD -changepw "NSS Certificate DB" -newpwfile /tmp/newpass.txt 81 | certutil -S -v 240 -k rsa -n "CN=localhost" -t "u,u,u" -x -s "CN=localhost" -d /tmp/nssdb -f /tmp/newpass.txt -z /tmp/noise.txt 82 | 83 | # https://bugzilla.redhat.com/show_bug.cgi?id=1760437 84 | touch /tmp/nssdb/secmod.db 85 | 86 | cat <conf/pkcs11.cfg 87 | name=testPkcs11 88 | nssLibraryDirectory=/usr/lib/x86_64-linux-gnu 89 | nssSecmodDirectory=/tmp/nssdb 90 | nssModule=keystore 91 | EOT 92 | ``` 93 | -------------------------------------------------------------------------------- /distribution/bin/jsignpdf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIRNAME=$(dirname "$(readlink -e "$0")") 4 | DIR=$(cd "$DIRNAME" || exit 112; pwd) 5 | 6 | [ "$OSTYPE" = "cygwin" ] && DIR="$( cygpath -m "$DIR" )" 7 | 8 | JAVA=java 9 | if [ -n "$JAVA_HOME" ]; then 10 | JAVA="$JAVA_HOME/bin/java" 11 | fi 12 | 13 | JAVA_VERSION=$("$JAVA" -cp "$DIR/JSignPdf.jar" net.sf.jsignpdf.JavaVersion) 14 | if [ "$JAVA_VERSION" -gt "8" ]; then 15 | JAVA_OPTS="$JAVA_OPTS \ 16 | --add-exports jdk.crypto.cryptoki/sun.security.pkcs11=ALL-UNNAMED \ 17 | --add-exports jdk.crypto.cryptoki/sun.security.pkcs11.wrapper=ALL-UNNAMED \ 18 | --add-exports java.base/sun.security.action=ALL-UNNAMED \ 19 | --add-exports java.base/sun.security.rsa=ALL-UNNAMED \ 20 | --add-opens java.base/java.security=ALL-UNNAMED \ 21 | --add-opens java.base/sun.security.util=ALL-UNNAMED" 22 | fi 23 | 24 | "$JAVA" $JAVA_OPTS "-Djsignpdf.home=$DIR" -jar "$DIR/JSignPdf.jar" "$@" 25 | -------------------------------------------------------------------------------- /distribution/conf/conf.properties: -------------------------------------------------------------------------------- 1 | # Global properties for advanced JSignPdf configuration 2 | 3 | # font.path is a path to font used in visible signature 4 | #font.path=C:\\WINNT\\Fonts\\VLADIMIR.ttf 5 | 6 | # font.name is the name of font in the font-file filled in font.path property. 7 | #font.name=vladimir.ttf 8 | 9 | # font encoding of choosen font: Cp1250, Cp1252, Cp1257, Cp1250, Identity-H, Identity-V, MacRoman 10 | #font.encoding=Cp1250 11 | 12 | # setting property certificate.checkValidity to false, you can disable validity checks 13 | #certificate.checkValidity=false 14 | 15 | # by setting property certificate.checkKeyUsage to false, you can disable keyUsage checks 16 | # i.e. checks that the certificate purpose is "digitalSignature" or "nonRepudiation" 17 | #certificate.checkKeyUsage=false 18 | 19 | # by setting property certificate.checkCriticalExtensions to true (or commenting out), 20 | # you can enable critical extension checks 21 | # i.e. checks that all certificate extensions marked as critical are supported (or known) by JSignPdf 22 | # JSignPdf currently supports following critical extensions: 23 | # 2.5.29.15 - KeyUsage 24 | # 2.5.29.17 - Subject Alternative Name 25 | # 2.5.29.19 - Basic Constraints 26 | # 2.5.29.29 - Certificate Issuer 27 | # 2.5.29.37 - Extended Key Usage 28 | certificate.checkCriticalExtensions=false 29 | 30 | # pkcs11config.path is a path (either absolute or relative to the working directory) to PKCS#11 provider configuration; 31 | # if the file exists it's used to register a new SunPKCS11 provider instance 32 | # as described in http://download.oracle.com/javase/6/docs/technotes/guides/security/p11guide.html 33 | #pkcs11config.path=conf/pkcs11.cfg 34 | 35 | # relax.ssl.security is a true/false flag (false is default) which can disable some SSL checks. If the value is true, 36 | # then for instance the JSignPdf will trust all server certificates when making requests to TSA or OCSP. 37 | relax.ssl.security=true 38 | 39 | # pdf2image.libraries is a comma-separated list of libraries, which should be used to retrieve PDF page preview. The order 40 | # does matter here. The first successfully generated image wins. Supported library names are jpedal, pdfbox and pdfrenderer 41 | # Default value: 'jpedal,pdfbox,pdfrenderer' 42 | pdf2image.libraries=jpedal,pdfbox,pdfrenderer 43 | 44 | # tsa.hashAlgorithm is a default hash algorithm name used when requesting time-stamp from a TSA (SHA-1, SHA-256, SHA-384, SHA-512, ...) 45 | # Default value: 'SHA-1' 46 | tsa.hashAlgorithm=SHA-1 47 | -------------------------------------------------------------------------------- /distribution/conf/pkcs11.cfg: -------------------------------------------------------------------------------- 1 | # Sample file for registering PKCS#11 security provider in JSignPdf 2 | # Feel free to edit it and then set path to the file in the conf.properties configuration file. 3 | 4 | # Look for full list of possible attributes at 5 | # http://download.oracle.com/javase/8/docs/technotes/guides/security/p11guide.html#ATTRS 6 | 7 | name=JSignPdf 8 | 9 | library=/usr/lib/libeToken.so 10 | slot=1 11 | -------------------------------------------------------------------------------- /distribution/doc/icon/Certificate.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/Certificate.ico -------------------------------------------------------------------------------- /distribution/doc/icon/icons.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/icons.ico -------------------------------------------------------------------------------- /distribution/doc/icon/icons.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/icons.xcf -------------------------------------------------------------------------------- /distribution/doc/icon/iconverticons.com/favicon_16x16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/iconverticons.com/favicon_16x16.ico -------------------------------------------------------------------------------- /distribution/doc/icon/iconverticons.com/favicon_32x32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/iconverticons.com/favicon_32x32.ico -------------------------------------------------------------------------------- /distribution/doc/icon/iconverticons.com/signedpdf.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/iconverticons.com/signedpdf.icns -------------------------------------------------------------------------------- /distribution/doc/icon/iconverticons.com/signedpdf.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/iconverticons.com/signedpdf.ico -------------------------------------------------------------------------------- /distribution/doc/icon/iconverticons.com/signedpdf_128x128x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/iconverticons.com/signedpdf_128x128x32.png -------------------------------------------------------------------------------- /distribution/doc/icon/iconverticons.com/signedpdf_16x16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/iconverticons.com/signedpdf_16x16x32.png -------------------------------------------------------------------------------- /distribution/doc/icon/iconverticons.com/signedpdf_32x32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/iconverticons.com/signedpdf_32x32x32.png -------------------------------------------------------------------------------- /distribution/doc/icon/iconverticons.com/signedpdf_48x48x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/iconverticons.com/signedpdf_48x48x32.png -------------------------------------------------------------------------------- /distribution/doc/icon/jsignpdf_ncblue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/jsignpdf_ncblue.png -------------------------------------------------------------------------------- /distribution/doc/icon/jsignpdf_ncblue.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/jsignpdf_ncblue.xcf -------------------------------------------------------------------------------- /distribution/doc/icon/logojsignpdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/logojsignpdf.png -------------------------------------------------------------------------------- /distribution/doc/icon/logojsignpdf.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/logojsignpdf.xcf -------------------------------------------------------------------------------- /distribution/doc/icon/misc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/misc.ico -------------------------------------------------------------------------------- /distribution/doc/icon/signedpdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/signedpdf.png -------------------------------------------------------------------------------- /distribution/doc/icon/signedpdf.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/signedpdf.xcf -------------------------------------------------------------------------------- /distribution/doc/icon/signedpdf_notext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/signedpdf_notext.png -------------------------------------------------------------------------------- /distribution/doc/icon/splash08.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/splash08.bmp -------------------------------------------------------------------------------- /distribution/doc/icon/splash08.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/splash08.xcf -------------------------------------------------------------------------------- /distribution/doc/icon/splash_1.0.0.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/splash_1.0.0.bmp -------------------------------------------------------------------------------- /distribution/doc/icon/splash_1.0.0.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/doc/icon/splash_1.0.0.xcf -------------------------------------------------------------------------------- /distribution/images/signedpdf16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/images/signedpdf16.png -------------------------------------------------------------------------------- /distribution/images/signedpdf26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/distribution/images/signedpdf26.png -------------------------------------------------------------------------------- /distribution/licenses/ThirdPartyLicenses/DejaVu-font.license: -------------------------------------------------------------------------------- 1 | Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. 2 | Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below) 3 | 4 | Bitstream Vera Fonts Copyright 5 | ------------------------------ 6 | 7 | Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is 8 | a trademark of Bitstream, Inc. 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of the fonts accompanying this license ("Fonts") and associated 12 | documentation files (the "Font Software"), to reproduce and distribute the 13 | Font Software, including without limitation the rights to use, copy, merge, 14 | publish, distribute, and/or sell copies of the Font Software, and to permit 15 | persons to whom the Font Software is furnished to do so, subject to the 16 | following conditions: 17 | 18 | The above copyright and trademark notices and this permission notice shall 19 | be included in all copies of one or more of the Font Software typefaces. 20 | 21 | The Font Software may be modified, altered, or added to, and in particular 22 | the designs of glyphs or characters in the Fonts may be modified and 23 | additional glyphs or characters may be added to the Fonts, only if the fonts 24 | are renamed to names not containing either the words "Bitstream" or the word 25 | "Vera". 26 | 27 | This License becomes null and void to the extent applicable to Fonts or Font 28 | Software that has been modified and is distributed under the "Bitstream 29 | Vera" names. 30 | 31 | The Font Software may be sold as part of a larger software package but no 32 | copy of one or more of the Font Software typefaces may be sold by itself. 33 | 34 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 35 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, 36 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, 37 | TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME 38 | FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING 39 | ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, 40 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 41 | THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE 42 | FONT SOFTWARE. 43 | 44 | Except as contained in this notice, the names of Gnome, the Gnome 45 | Foundation, and Bitstream Inc., shall not be used in advertising or 46 | otherwise to promote the sale, use or other dealings in this Font Software 47 | without prior written authorization from the Gnome Foundation or Bitstream 48 | Inc., respectively. For further information, contact: fonts at gnome dot 49 | org. 50 | 51 | Arev Fonts Copyright 52 | ------------------------------ 53 | 54 | Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. 55 | 56 | Permission is hereby granted, free of charge, to any person obtaining 57 | a copy of the fonts accompanying this license ("Fonts") and 58 | associated documentation files (the "Font Software"), to reproduce 59 | and distribute the modifications to the Bitstream Vera Font Software, 60 | including without limitation the rights to use, copy, merge, publish, 61 | distribute, and/or sell copies of the Font Software, and to permit 62 | persons to whom the Font Software is furnished to do so, subject to 63 | the following conditions: 64 | 65 | The above copyright and trademark notices and this permission notice 66 | shall be included in all copies of one or more of the Font Software 67 | typefaces. 68 | 69 | The Font Software may be modified, altered, or added to, and in 70 | particular the designs of glyphs or characters in the Fonts may be 71 | modified and additional glyphs or characters may be added to the 72 | Fonts, only if the fonts are renamed to names not containing either 73 | the words "Tavmjong Bah" or the word "Arev". 74 | 75 | This License becomes null and void to the extent applicable to Fonts 76 | or Font Software that has been modified and is distributed under the 77 | "Tavmjong Bah Arev" names. 78 | 79 | The Font Software may be sold as part of a larger software package but 80 | no copy of one or more of the Font Software typefaces may be sold by 81 | itself. 82 | 83 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 84 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 85 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 86 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL 87 | TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 88 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 89 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 90 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 91 | OTHER DEALINGS IN THE FONT SOFTWARE. 92 | 93 | Except as contained in this notice, the name of Tavmjong Bah shall not 94 | be used in advertising or otherwise to promote the sale, use or other 95 | dealings in this Font Software without prior written authorization 96 | from Tavmjong Bah. For further information, contact: tavmjong @ free 97 | . fr. 98 | 99 | $Id: DejaVu-font.license,v 1.1 2012/04/14 20:03:30 kwart Exp $ 100 | -------------------------------------------------------------------------------- /distribution/licenses/ThirdPartyLicenses/InstallCert.license: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * - Neither the name of Sun Microsystems nor the names of its 16 | * contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 20 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | -------------------------------------------------------------------------------- /distribution/licenses/ThirdPartyLicenses/bouncycastle.license: -------------------------------------------------------------------------------- 1 | License 2 | 3 | Copyright (c) 2000 - 2006 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /distribution/licenses/ThirdPartyLicenses/icu4j.license: -------------------------------------------------------------------------------- 1 | ICU License - ICU 1.8.1 and later 2 | 3 | COPYRIGHT AND PERMISSION NOTICE 4 | 5 | Copyright (c) 1995-2009 International Business Machines Corporation and others 6 | 7 | All rights reserved. 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 12 | 13 | Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. 14 | ------------------------------------ 15 | All trademarks and registered trademarks mentioned herein are the property of their respective owners. -------------------------------------------------------------------------------- /distribution/licenses/ThirdPartyLicenses/pokrytie_font.license: -------------------------------------------------------------------------------- 1 | Font author: Andrei Nesterov (http://andnesterov.livejournal.com/) 2 | Downloaded from: http://openfontlibrary.org/ 3 | 4 | Creative Commons License Deed 5 | Copyright-Only Dedication{*} (based on United States law) 6 | or Public Domain Certification 7 | {[This license is acceptable for Free Cultural Works.] } 8 | 9 | The person or persons who have associated work with this document (the 10 | "Dedicator" or "Certifier") hereby either (a) certifies that, to the best 11 | of his knowledge, the work of authorship identified is in the public domain 12 | of the country from which the work is published, or (b) hereby dedicates 13 | whatever copyright the dedicators holds in the work of authorship identified 14 | below (the "Work") to the public domain. A certifier, moreover, dedicates any 15 | copyright interest he may have in the associated work, and for these purposes, 16 | is described as a "dedicator" below. 17 | 18 | A certifier has taken reasonable steps to verify the copyright status of this 19 | work. Certifier recognizes that his good faith efforts may not shield him from 20 | liability if in fact the work certified is not in the public domain. 21 | 22 | Dedicator makes this dedication for the benefit of the public at large and 23 | to the detriment of the Dedicator's heirs and successors. Dedicator intends 24 | this dedication to be an overt act of relinquishment in perpetuity of all 25 | present and future rights under copyright law, whether vested or contingent, 26 | in the Work. Dedicator understands that such relinquishment of all rights 27 | includes the relinquishment of all rights to enforce (by lawsuit or otherwise) 28 | those copyrights in the Work. 29 | 30 | Dedicator recognizes that, once placed in the public domain, the Work may be 31 | freely reproduced, distributed, transmitted, used, modified, built upon, 32 | or otherwise exploited by anyone for any purpose, commercial or non-commercial, 33 | and in any way, including by methods that have not yet been invented or conceived. 34 | -------------------------------------------------------------------------------- /distribution/licenses/ThirdPartyLicenses/splashscreen.info: -------------------------------------------------------------------------------- 1 | Background image "Hand Holding Pen" used in splashscreen comes from the site http://photos8.com/ (Place for Free Photos and Desktop Wallpapers) -------------------------------------------------------------------------------- /distribution/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | jsignpdf-distribution 5 | ${project.artifactId} 6 | pom 7 | 8 | 9 | com.github.kwart.jsign 10 | jsignpdf-root 11 | 2.4.0-SNAPSHOT 12 | ../pom.xml 13 | 14 | 15 | 16 | 2.2.2 17 | 2.3.17 18 | 2.5.7 19 | 9.3.3.0 20 | 21 | 22 | 23 | 24 | 25 | org.apache.maven.plugins 26 | maven-assembly-plugin 27 | ${maven.assembly.plugin.version} 28 | 29 | 30 | distro-assembly 31 | package 32 | 33 | single 34 | 35 | 36 | jsignpdf-${project.version} 37 | false 38 | 39 | src/assembly/assembly.xml 40 | 41 | false 42 | posix 43 | 44 | 45 | 46 | 47 | 48 | org.apache.maven.plugins 49 | maven-enforcer-plugin 50 | 51 | 52 | enforce-versions 53 | 54 | enforce 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | org.asciidoctor 66 | asciidoctor-maven-plugin 67 | ${asciidoctor.maven.plugin.version} 68 | 69 | 70 | org.asciidoctor 71 | asciidoctorj-pdf 72 | ${asciidoctorj.pdf.version} 73 | 74 | 75 | 76 | org.jruby 77 | jruby-complete 78 | ${jruby.version} 79 | 80 | 81 | 82 | org.asciidoctor 83 | asciidoctorj 84 | ${asciidoctorj.version} 85 | 86 | 87 | 88 | ../website/docs 89 | 90 | ${project.build.sourceDirectory} 91 | ${project.version} 92 | 93 | 94 | 95 | 96 | generate-pdf-doc 97 | generate-resources 98 | 99 | process-asciidoc 100 | 101 | 102 | pdf 103 | 104 | coderay 105 | font 106 | 107 | 108 | 109 | - 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | ${project.groupId} 120 | jsignpdf 121 | ${project.version} 122 | jar-with-dependencies 123 | 124 | 125 | ${project.groupId} 126 | installcert 127 | ${project.version} 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /distribution/src/assembly/assembly.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | JSignPdf Assembly 5 | 6 | zip 7 | 8 | 9 | 10 | false 11 | 12 | com.github.kwart.jsign:jsignpdf:jar:jar-with-dependencies 13 | 14 | / 15 | JSignPdf.jar 16 | 17 | 18 | false 19 | 20 | com.github.kwart.jsign:installcert 21 | 22 | / 23 | InstallCert.jar 24 | 25 | 26 | 27 | 28 | 29 | bin 30 | / 31 | 0755 32 | 33 | *.sh 34 | *.bat 35 | 36 | 37 | 38 | conf 39 | /conf/ 40 | 41 | 42 | licenses 43 | /licenses/ 44 | 45 | 46 | target/generated-docs 47 | /docs/ 48 | 49 | *.txt 50 | *.pdf 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /distribution/windows/JSignPdf.iss: -------------------------------------------------------------------------------- 1 | [Files] 2 | ; Place all x64 files here 3 | Source: "{#DistDir}\jre64\*"; DestDir: "{app}\jre"; Flags: recursesubdirs; Check: Is64BitInstallMode 4 | 5 | ; Place all x86 files here, first one should be marked 'solidbreak' 6 | Source: "{#DistDir}\jre32\*"; DestDir: "{app}\jre"; Flags: recursesubdirs solidbreak; Check: not Is64BitInstallMode; 7 | 8 | ; Place all common files here, first one should be marked 'solidbreak' 9 | Source: "{#DistDir}\*"; Excludes: "jre32,jre64"; DestDir: "{app}"; Flags: recursesubdirs solidbreak 10 | 11 | [Setup] 12 | AppName={#MyAppName} 13 | AppId={#MyAppId} 14 | AppVerName={#MyAppName} {#MyAppVersion} 15 | DefaultDirName={autopf}\{#MyAppName} 16 | DefaultGroupName={#MyAppName} 17 | LicenseFile={#DistDir}\licenses\MPL-2.0.txt 18 | OutputBaseFilename={#MyAppName}_setup_{#MyAppVersion} 19 | VersionInfoVersion={#MyAppVersionWin} 20 | VersionInfoCompany=Josef Cacek 21 | VersionInfoDescription=JSignPdf adds digital signatures to PDF documents 22 | AppPublisher=Josef Cacek 23 | AppSupportURL=http://jsignpdf.sourceforge.net/ 24 | AppVersion={#MyAppVersion} 25 | OutputDir={#OutputDir} 26 | ;WizardStyle=modern 27 | Compression=lzma2 28 | SolidCompression=yes 29 | ArchitecturesInstallIn64BitMode=x64 30 | UninstallDisplayIcon={app}\JSignPdf.exe 31 | 32 | [Icons] 33 | Name: {group}\JSignPdf {#MyAppVersion}; Filename: {app}\JSignPdf.exe; Components: ; WorkingDir: {app} 34 | Name: {group}\InstallCert Tool; Filename: {app}\InstallCert.exe; Components: ; WorkingDir: {app} 35 | Name: {group}\JSignPdf Guide; Filename: {app}\docs\JSignPdf.pdf; Components: 36 | Name: {group}\Uninstall {#MyAppName}; Filename: {uninstallexe}; Components: 37 | 38 | [UninstallDelete] 39 | ;Name: {%USERPROFILE}\.JSignPdf; Type: files; Components: 40 | 41 | [Code] 42 | //********** Check if application is already installed 43 | function MyAppInstalled: Boolean; 44 | begin 45 | Result := RegKeyExists(HKEY_LOCAL_MACHINE, 46 | 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppID}_is1'); 47 | end; 48 | 49 | //********** If app already installed, uninstall it before setup. 50 | function InitializeSetup(): Boolean; 51 | var 52 | uninstaller: String; 53 | oldVersion: String; 54 | ErrorCode: Integer; 55 | begin 56 | if not MyAppInstalled then begin 57 | Result := True; 58 | Exit; 59 | end; 60 | RegQueryStringValue(HKEY_LOCAL_MACHINE, 61 | 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppID}_is1', 62 | 'DisplayName', oldVersion); 63 | if (MsgBox(oldVersion + ' is already installed, it has to be uninstalled before installation. Continue?', 64 | mbConfirmation, MB_YESNO) = IDNO) then begin 65 | Result := False; 66 | Exit; 67 | end; 68 | 69 | RegQueryStringValue(HKEY_LOCAL_MACHINE, 70 | 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppID}_is1', 71 | 'QuietUninstallString', uninstaller); 72 | Exec('>', uninstaller, '', SW_SHOW, ewWaitUntilTerminated, ErrorCode); 73 | if (ErrorCode <> 0) then begin 74 | MsgBox('Failed to uninstall previous version. . Please run {#MyAppName} uninstaller manually from Start menu or Control Panel and then run installer again.', 75 | mbError, MB_OK ); 76 | Result := False; 77 | Exit; 78 | end; 79 | 80 | Result := True; 81 | end; 82 | -------------------------------------------------------------------------------- /distribution/windows/ant-build-create-launchers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Builds JSignPdf Launch4J wrappers 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 22 | 23 | 24 | 31 | 32 | 33 | 35 | 36 | 37 | 41 | 42 | 49 | 50 | 51 | 53 | 54 | 55 | 59 | 60 | 69 | 70 | 71 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /distribution/windows/create-jsignpdf-installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -x 4 | 5 | if [ ! -d /mnt/jsignpdf -o ! -d /mnt/distribution ]; then 6 | echo "JSignPdf expected to be mounted to /mnt" >&2 7 | exit 2; 8 | fi 9 | 10 | SRCPATH=$(ls /mnt/distribution/target/jsignpdf-*.zip) 11 | DIRNAME=$(dirname "$(readlink -e "$SRCPATH")") 12 | DIR=$(cd "$DIRNAME" || exit 112; pwd) 13 | 14 | export PATH=$PATH:/opt/launch4j:/opt/ant/bin 15 | 16 | BUILDDIR=/tmp/build 17 | 18 | if [ -d ${BUILDDIR} ]; then 19 | rm -rf ${BUILDDIR} 20 | fi 21 | 22 | mkdir -p ${BUILDDIR} 23 | # workaround for running WINE with a custom user 24 | export HOME=${BUILDDIR} 25 | cp -r /root/.wine ${BUILDDIR} 26 | 27 | unzip -q "${SRCPATH}" -d ${BUILDDIR} 28 | if [ ! -d ${BUILDDIR}/jsignpdf-* ]; then 29 | echo "The zip $SRCPATH doesn't contain jsignpdf-* folder" >&2 30 | exit 3; 31 | fi 32 | 33 | DISTNAME=$(basename ${BUILDDIR}/jsignpdf-*) 34 | VERSION=$(echo $DISTNAME | sed s/jsignpdf-[a-zA-Z\-]*//) 35 | WINVERSION=$(echo $VERSION | sed 's/\([0-9\.]*\).*/\1/') 36 | while [ $(echo $WINVERSION |tr '.' '\n'|wc -l) -lt 4 ]; do 37 | WINVERSION="${WINVERSION}.0" 38 | done 39 | 40 | echo "WINVERSION=${WINVERSION}" 41 | 42 | TARGET=${BUILDDIR}/jsignpdf 43 | mv "${BUILDDIR}/${DISTNAME}" ${TARGET} 44 | 45 | cp -r /opt/jre{32,64} ${TARGET}/ 46 | ls -al ${TARGET} 47 | 48 | # Use Launch4j as the ant task because if used directly it fails to expand variables properly 49 | ant -f /mnt/distribution/windows/ant-build-create-launchers.xml \ 50 | "-Djsignpdf.version=${VERSION}" \ 51 | "-Djsignpdf.winversion=${WINVERSION}" \ 52 | "-Dbuild.dir=${BUILDDIR}" 53 | 54 | isscdistdir=$(winepath -w "${TARGET}") 55 | isscoutputdir=$(winepath -w "${DIR}") 56 | scriptpath=$(winepath -w "/mnt/distribution/windows/JSignPdf.iss") 57 | iscc /O+ "/DDistDir=${isccdistdir}" "/DOutputDir=${isccoutputdir}" \ 58 | /DMyAppName=JSignPdf /DMyAppVersion=${VERSION} /DMyAppVersionWin=${WINVERSION} \ 59 | /DMyAppId=JSignPdf "/DDistDir=${isscdistdir}" "/DOutputDir=${isscoutputdir}" \ 60 | "${scriptpath}" 61 | -------------------------------------------------------------------------------- /distribution/windows/launch4j-template.l4j.ini: -------------------------------------------------------------------------------- 1 | # Launch4j runtime config 2 | -Xms1g 3 | -Xmx1g 4 | --add-exports jdk.crypto.cryptoki/sun.security.pkcs11=ALL-UNNAMED 5 | --add-exports jdk.crypto.cryptoki/sun.security.pkcs11.wrapper=ALL-UNNAMED 6 | --add-exports java.base/sun.security.action=ALL-UNNAMED 7 | --add-exports java.base/sun.security.rsa=ALL-UNNAMED 8 | --add-opens java.base/sun.security.util=ALL-UNNAMED 9 | -Djsignpdf.home="%EXEDIR%" 10 | -------------------------------------------------------------------------------- /installcert/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | installcert 5 | jar 6 | ${project.artifactId} 7 | 8 | 9 | com.github.kwart.jsign 10 | jsignpdf-root 11 | 2.4.0-SNAPSHOT 12 | ../pom.xml 13 | 14 | 15 | 16 | net.sf.jsignpdf.InstallCert 17 | 18 | 19 | 20 | 21 | 22 | org.apache.maven.plugins 23 | maven-jar-plugin 24 | 25 | 26 | 27 | ${exec.mainClass} 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /jsignpdf/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | jsignpdf 5 | jar 6 | ${project.artifactId} 7 | 8 | 9 | com.github.kwart.jsign 10 | jsignpdf-root 11 | 2.4.0-SNAPSHOT 12 | ../pom.xml 13 | 14 | 15 | 16 | net.sf.jsignpdf.Signer 17 | 18 | 19 | 20 | 21 | 22 | org.apache.maven.plugins 23 | maven-dependency-plugin 24 | 25 | 26 | copy-dependencies 27 | package 28 | 29 | copy-dependencies 30 | 31 | 32 | 33 | 34 | compile 35 | 36 | 37 | 38 | maven-shade-plugin 39 | 40 | 41 | package 42 | 43 | shade 44 | 45 | 46 | 47 | 48 | true 49 | true 50 | true 51 | true 52 | jar-with-dependencies 53 | 54 | 55 | 56 | 57 | ${exec.mainClass} 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | com.github.librepdf 69 | openpdf 70 | 71 | 72 | org.bouncycastle 73 | bcprov-jdk15on 74 | 75 | 76 | org.bouncycastle 77 | bcpkix-jdk15on 78 | 79 | 80 | org.apache.commons 81 | commons-lang3 82 | 83 | 84 | commons-cli 85 | commons-cli 86 | 87 | 88 | commons-io 89 | commons-io 90 | 91 | 92 | com.github.rjolly 93 | pdf-renderer 94 | 95 | 96 | org.apache.pdfbox 97 | pdfbox 98 | 99 | 100 | com.github.kwart.jsign 101 | jsign-jpedal 102 | 103 | 104 | com.github.kwart.jsign 105 | jsign-pkcs11 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/JTextAreaHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf; 31 | 32 | import static net.sf.jsignpdf.Constants.NEW_LINE; 33 | 34 | import java.io.IOException; 35 | import java.io.PrintWriter; 36 | import java.io.StringWriter; 37 | import java.util.logging.Handler; 38 | import java.util.logging.LogRecord; 39 | 40 | import javax.swing.JTextArea; 41 | 42 | /** 43 | * Logging Handlerwhich appends messages to the provided {@link JTextArea} instance. 44 | * 45 | * @author Josef Cacek 46 | */ 47 | public class JTextAreaHandler extends Handler { 48 | 49 | private JTextArea jTextArea; 50 | 51 | /** 52 | * Constructor. 53 | * 54 | * @param jTextArea 55 | */ 56 | public JTextAreaHandler(final JTextArea jTextArea) { 57 | if (jTextArea == null) { 58 | throw new IllegalArgumentException("JTextArea has to be not-null."); 59 | } 60 | this.jTextArea = jTextArea; 61 | } 62 | 63 | @Override 64 | public void close() { 65 | jTextArea = null; 66 | } 67 | 68 | @Override 69 | public void publish(LogRecord record) { 70 | jTextArea.append(record.getLevel() + " " + record.getMessage() + NEW_LINE); 71 | Throwable thrown = record.getThrown(); 72 | if (thrown != null) { 73 | try (StringWriter stringWriter = new StringWriter()) { 74 | thrown.printStackTrace(new PrintWriter(stringWriter, true)); 75 | jTextArea.append(stringWriter.toString()); 76 | } catch (IOException e) { 77 | // should not happen :) 78 | } 79 | jTextArea.append(NEW_LINE); 80 | } 81 | // scroll TextArea 82 | jTextArea.setCaretPosition(jTextArea.getText().length()); 83 | } 84 | 85 | @Override 86 | public void flush() { 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/JavaVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf; 31 | 32 | /** 33 | * Prints major Java version. 34 | * 35 | * @author Josef Cacek 36 | */ 37 | public class JavaVersion { 38 | 39 | public static void main(String[] args) { 40 | System.out.println(getJavaMajorVersion()); 41 | } 42 | 43 | public static int getJavaMajorVersion() { 44 | Class rtVersionCl; 45 | 46 | try { 47 | rtVersionCl = Class.forName("java.lang.Runtime$Version"); 48 | } catch (ClassNotFoundException e) { 49 | return 8; 50 | } 51 | 52 | try { 53 | Object versionObj = Runtime.class.getDeclaredMethod("version").invoke(Runtime.getRuntime()); 54 | return (Integer) rtVersionCl.getDeclaredMethod("major").invoke(versionObj); 55 | } catch (Exception e) { 56 | return 8; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/PdfExtraInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf; 31 | 32 | import net.sf.jsignpdf.types.PageInfo; 33 | import net.sf.jsignpdf.utils.PdfUtils; 34 | 35 | import com.lowagie.text.Rectangle; 36 | import com.lowagie.text.pdf.PdfReader; 37 | 38 | /** 39 | * Provides additional information for selected input PDF file. 40 | * 41 | * @author Josef Cacek 42 | */ 43 | public class PdfExtraInfo { 44 | 45 | private BasicSignerOptions options; 46 | 47 | /** 48 | * @param anOptions 49 | */ 50 | public PdfExtraInfo(BasicSignerOptions anOptions) { 51 | options = anOptions; 52 | } 53 | 54 | /** 55 | * Returns number of pages in PDF document. If error occures (file not found or sth. similar) -1 is returned. 56 | * 57 | * @return number of pages (or -1 if error occures) 58 | */ 59 | public int getNumberOfPages() { 60 | int tmpResult = 0; 61 | PdfReader reader = null; 62 | try { 63 | try { 64 | reader = new PdfReader(options.getInFile(), options.getPdfOwnerPwdStrX().getBytes()); 65 | } catch (Exception e) { 66 | try { 67 | reader = new PdfReader(options.getInFile(), new byte[0]); 68 | } catch (Exception e2) { 69 | // try to read without password 70 | reader = new PdfReader(options.getInFile()); 71 | } 72 | } 73 | tmpResult = reader.getNumberOfPages(); 74 | } catch (Exception e) { 75 | tmpResult = -1; 76 | } finally { 77 | if (reader != null) { 78 | try { 79 | reader.close(); 80 | } catch (Exception e) { 81 | } 82 | } 83 | } 84 | 85 | return tmpResult; 86 | } 87 | 88 | /** 89 | * Returns page info. 90 | * 91 | * @param aPage number of page for which size should be returned 92 | * @return FloatPoint or null 93 | */ 94 | public PageInfo getPageInfo(int aPage) { 95 | PageInfo tmpResult = null; 96 | PdfReader reader = null; 97 | try { 98 | reader = PdfUtils.getPdfReader(options.getInFile(), options.getPdfOwnerPwdStrX().getBytes()); 99 | final Rectangle tmpRect = reader.getPageSizeWithRotation(aPage); 100 | if (tmpRect != null) { 101 | tmpResult = new PageInfo(tmpRect.getRight(), tmpRect.getTop()); 102 | } 103 | } catch (Exception e) { 104 | // nothing to do 105 | } finally { 106 | if (reader != null) { 107 | try { 108 | reader.close(); 109 | } catch (Exception e) { 110 | } 111 | } 112 | } 113 | 114 | return tmpResult; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/PrivateKeyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf; 31 | 32 | import java.security.PrivateKey; 33 | import java.security.cert.Certificate; 34 | 35 | /** 36 | * Helper class (POI) which holds private key and the assigned certificates. 37 | * 38 | * @author Josef Cacek 39 | */ 40 | public class PrivateKeyInfo { 41 | 42 | private PrivateKey key; 43 | private Certificate[] chain; 44 | 45 | public PrivateKeyInfo() { 46 | } 47 | 48 | /** 49 | * Creates instance and fills fields. 50 | * 51 | * @param key 52 | * @param chain 53 | */ 54 | public PrivateKeyInfo(PrivateKey key, Certificate[] chain) { 55 | super(); 56 | this.key = key; 57 | this.chain = chain; 58 | } 59 | 60 | /** 61 | * @return the key 62 | */ 63 | public PrivateKey getKey() { 64 | return key; 65 | } 66 | 67 | /** 68 | * @param key the key to set 69 | */ 70 | public void setKey(PrivateKey key) { 71 | this.key = key; 72 | } 73 | 74 | /** 75 | * @return the chain 76 | */ 77 | public Certificate[] getChain() { 78 | return chain; 79 | } 80 | 81 | /** 82 | * @param chain the chain to set 83 | */ 84 | public void setChain(Certificate[] chain) { 85 | this.chain = chain; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/SignResultListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf; 31 | 32 | /** 33 | * Listener class for "signing finished" event. 34 | * 35 | * @author Josef Cacek 36 | */ 37 | public interface SignResultListener { 38 | 39 | /** 40 | * Method fired when signer finishes. Parameter says if it was successful. 41 | * 42 | * @param e null if finished succesfully or the reason (Exception) 43 | */ 44 | void signerFinishedEvent(Throwable e); 45 | } 46 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/SignerFileChooser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf; 31 | 32 | import static net.sf.jsignpdf.Constants.RES; 33 | 34 | import java.io.File; 35 | 36 | import javax.swing.JFileChooser; 37 | import javax.swing.JOptionPane; 38 | import javax.swing.JTextField; 39 | import javax.swing.filechooser.FileFilter; 40 | import javax.swing.plaf.basic.BasicFileChooserUI; 41 | 42 | /** 43 | * Improved JFileChooser. It contains some small bug-fixes. 44 | * 45 | * @author Josef Cacek 46 | */ 47 | public class SignerFileChooser extends JFileChooser { 48 | 49 | private static final long serialVersionUID = 1L; 50 | 51 | /** 52 | * File filter for PDF files 53 | */ 54 | public static final FileFilter FILEFILTER_PDF = new FileFilter() { 55 | public boolean accept(File f) { 56 | return f.isDirectory() || f.getName().toLowerCase().endsWith(".pdf"); 57 | } 58 | 59 | public String getDescription() { 60 | return RES.get("filefilter.pdf"); 61 | } 62 | }; 63 | 64 | /** 65 | * Shows rewrite confirmation dialog for SAVE_DIALOGs, when the selected file already exists. 66 | * 67 | * @see javax.swing.JFileChooser#approveSelection() 68 | */ 69 | @Override 70 | public void approveSelection() { 71 | if (getDialogType() == SAVE_DIALOG) { 72 | File file = getSelectedFile(); 73 | if (file != null && file.exists()) { 74 | if (!confirmOverwrite(file)) { 75 | // User doesn't want to overwrite the file 76 | return; 77 | } 78 | } 79 | } 80 | super.approveSelection(); 81 | } 82 | 83 | /** 84 | * Shows question dialog "File exists. Overwrite?" 85 | * 86 | * @param file file 87 | * @return 88 | */ 89 | private boolean confirmOverwrite(File file) { 90 | final String tmpMessage = RES.get("filechooser.overwrite.question", new String[] { file.getAbsolutePath() }); 91 | return JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(this, tmpMessage, RES.get("filechooser.save.warning"), 92 | JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null); 93 | } 94 | 95 | /** 96 | * Clears file name when null file is provided. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4893572 97 | * 98 | * @see javax.swing.JFileChooser#setSelectedFile(java.io.File) 99 | */ 100 | @Override 101 | public void setSelectedFile(File file) { 102 | super.setSelectedFile(file); 103 | // safety check 104 | if (getUI() instanceof BasicFileChooserUI) { 105 | // grab the ui and set the filename 106 | BasicFileChooserUI tmpUi = (BasicFileChooserUI) getUI(); 107 | tmpUi.setFileName(file == null ? "" : file.getName()); 108 | } 109 | } 110 | 111 | /** 112 | * Displays file chooser dialog of given type and with givet FileFilter. 113 | * 114 | * @param aFileField assigned textfield 115 | * @param aFilter filefilter 116 | * @param aType dialog type (SAVE_DIALOG, OPEN_DIALOG) 117 | */ 118 | public void showFileChooser(final JTextField aFileField, final FileFilter aFilter, final int aType) { 119 | setDialogType(aType); 120 | resetChoosableFileFilters(); 121 | if (aFilter != null) { 122 | setFileFilter(aFilter); 123 | } 124 | String tmpFileName = aFileField.getText(); 125 | if (tmpFileName == null || tmpFileName.length() == 0) { 126 | setSelectedFile(null); 127 | } else { 128 | File tmpFile = new File(tmpFileName); 129 | setSelectedFile(tmpFile); 130 | } 131 | if (JFileChooser.APPROVE_OPTION == showDialog(this, null)) { 132 | aFileField.setText(getSelectedFile().getAbsolutePath()); 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/UncompressPdf.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf; 31 | 32 | import java.io.FileOutputStream; 33 | import java.io.IOException; 34 | 35 | import com.lowagie.text.Document; 36 | import com.lowagie.text.DocumentException; 37 | import com.lowagie.text.pdf.PdfReader; 38 | import com.lowagie.text.pdf.PdfStamper; 39 | 40 | /** 41 | * Simple small programm to uncompress PDFs. 42 | * 43 | * @author Josef Cacek 44 | */ 45 | public class UncompressPdf { 46 | 47 | /** 48 | * The main 'main'. 49 | * 50 | * @param args 51 | */ 52 | public static void main(String[] args) { 53 | if (args == null || args.length == 0) { 54 | System.out.println("Usage:\njava " + UncompressPdf.class.getName() + " file.pdf [file2.pdf [...]]"); 55 | return; 56 | } 57 | Document.compress = false; 58 | for (String tmpFile : args) { 59 | String newFileName = null; 60 | if (tmpFile.toLowerCase().endsWith(".pdf")) { 61 | newFileName = tmpFile.substring(0, tmpFile.length() - 4) + "_uncompressed.pdf"; 62 | } else { 63 | newFileName = tmpFile + "_uncompressed.pdf"; 64 | } 65 | System.out.println("Uncompressing " + tmpFile + " to " + newFileName); 66 | try { 67 | PdfReader reader = new PdfReader(tmpFile); 68 | PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(newFileName), '\0'); 69 | int total = reader.getNumberOfPages() + 1; 70 | for (int i = 1; i < total; i++) { 71 | reader.setPageContent(i, reader.getPageContent(i)); 72 | } 73 | stamper.close(); 74 | } catch (NullPointerException npe) { 75 | npe.printStackTrace(); 76 | } catch (DocumentException e) { 77 | e.printStackTrace(); 78 | } catch (IOException e) { 79 | e.printStackTrace(); 80 | } 81 | } 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/extcsp/IExternalCryptoProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): CloudFoxy. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.extcsp; 31 | 32 | import net.sf.jsignpdf.BasicSignerOptions; 33 | 34 | import java.security.cert.Certificate; 35 | import java.util.LinkedList; 36 | 37 | public interface IExternalCryptoProvider { 38 | 39 | /** 40 | * Get the CSP name for GUI 41 | * 42 | * @return String - the CSP name 43 | */ 44 | String getName(); 45 | 46 | /** 47 | * The method returns a certificate chain for the provided alias 48 | * 49 | * @param options - command line / GUI provided options like keystore, PIN/password, alias, ... 50 | * @return Certificate[] - a list of certificates, or null if there was an error 51 | */ 52 | Certificate[] getChain(BasicSignerOptions options); 53 | 54 | /** 55 | * The methods takes an initial fingerprint of the document, and creates and external signature, which can be used for the 56 | * 'setExternalDigest' method. 57 | * 58 | * @param options - command line / GUI provided options like keystore, PIN/password, alias, ... 59 | * @param fingerprint - byte array containing the document fingerprint (only SHA1 and SHA256 are supported) 60 | * @return byte[] with the signature, null if there was an error 61 | */ 62 | byte[] getSignature(BasicSignerOptions options, byte[] fingerprint); 63 | 64 | /** 65 | * Query the crypto provider and return a list of aliases available. 66 | * 67 | * @param options - command line / GUI provided options like keystore, PIN/password, alias, ... 68 | * @return LinkedList - a list of names 69 | * @throws NullPointerException - when the list can't be created 70 | */ 71 | public LinkedList getAliasesList(BasicSignerOptions options) throws NullPointerException; 72 | } 73 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/preview/FinalPropertyChangeSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.preview; 31 | 32 | import java.beans.PropertyChangeSupport; 33 | 34 | /** 35 | * Final subclass of {@link PropertyChangeSupport}. It should bring better performance. 36 | * 37 | * @author Josef Cacek 38 | */ 39 | public final class FinalPropertyChangeSupport extends PropertyChangeSupport { 40 | 41 | // Serialization version ID 42 | static final long serialVersionUID = 1L; 43 | 44 | /** 45 | * Constructs a FinalPropertyChangeSupport object. 46 | * 47 | * @param sourceBean The bean to be given as the source for any events. 48 | */ 49 | public FinalPropertyChangeSupport(final Object sourceBean) { 50 | super(sourceBean); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/ssl/DynamicX509TrustManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.ssl; 31 | 32 | import java.io.IOException; 33 | import java.security.KeyStore; 34 | import java.security.KeyStoreException; 35 | import java.security.NoSuchAlgorithmException; 36 | import java.security.cert.CertificateException; 37 | import java.security.cert.X509Certificate; 38 | import java.util.UUID; 39 | 40 | import javax.net.ssl.TrustManager; 41 | import javax.net.ssl.TrustManagerFactory; 42 | import javax.net.ssl.X509TrustManager; 43 | 44 | import net.sf.jsignpdf.Constants; 45 | import net.sf.jsignpdf.utils.KeyStoreUtils; 46 | 47 | /** 48 | * TrustManager which works with in-memory copy of cacerts truststore. If {@link Constants#RELAX_SSL_SECURITY} is true then it 49 | * adds missing server certificates to the truststore. 50 | * 51 | * @author Josef Cacek 52 | */ 53 | public class DynamicX509TrustManager implements X509TrustManager { 54 | 55 | private final KeyStore trustStore; 56 | private final TrustManagerFactory trustManagerFactory; 57 | 58 | private X509TrustManager trustManager; 59 | 60 | /** 61 | * Constructor. 62 | * 63 | * @throws KeyStoreException 64 | * @throws NoSuchAlgorithmException 65 | * @throws CertificateException 66 | * @throws IOException 67 | */ 68 | public DynamicX509TrustManager() { 69 | try { 70 | this.trustStore = KeyStoreUtils.createTrustStore(); 71 | trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); 72 | reloadTrustStore(); 73 | } catch (Exception e) { 74 | throw new RuntimeException("Unable to create TrustManager.", e); 75 | } 76 | } 77 | 78 | /** 79 | * Checks client's cert-chain - no extra step here. 80 | * 81 | * @see javax.net.ssl.X509TrustManager#checkClientTrusted(java.security.cert.X509Certificate[], java.lang.String) 82 | */ 83 | public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { 84 | trustManager.checkClientTrusted(chain, authType); 85 | } 86 | 87 | /** 88 | * Checks server's cert-chain. If check fails and {@link Constants#RELAX_SSL_SECURITY} is true then the first certificate 89 | * from the chain is added to the truststore and the check is repeated. 90 | * 91 | * @see javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert.X509Certificate[], java.lang.String) 92 | */ 93 | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { 94 | if (Constants.RELAX_SSL_SECURITY) { 95 | try { 96 | trustManager.checkServerTrusted(chain, authType); 97 | } catch (CertificateException cx) { 98 | try { 99 | trustStore.setCertificateEntry(UUID.randomUUID().toString(), chain[0]); 100 | reloadTrustStore(); 101 | } catch (Exception e) { 102 | throw new CertificateException("Unable to recreate TrustManager", e); 103 | } 104 | trustManager.checkServerTrusted(chain, authType); 105 | } 106 | } else { 107 | trustManager.checkServerTrusted(chain, authType); 108 | } 109 | } 110 | 111 | /* 112 | * (non-Javadoc) 113 | * 114 | * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers() 115 | */ 116 | public X509Certificate[] getAcceptedIssuers() { 117 | return trustManager.getAcceptedIssuers(); 118 | } 119 | 120 | /** 121 | * Reloads the in-memory trustore. 122 | * 123 | * @throws KeyStoreException 124 | * @throws NoSuchAlgorithmException 125 | */ 126 | private void reloadTrustStore() throws KeyStoreException, NoSuchAlgorithmException { 127 | trustManagerFactory.init(trustStore); 128 | // acquire X509 trust manager from factory 129 | TrustManager tms[] = trustManagerFactory.getTrustManagers(); 130 | for (int i = 0; i < tms.length; i++) { 131 | if (tms[i] instanceof X509TrustManager) { 132 | trustManager = (X509TrustManager) tms[i]; 133 | return; 134 | } 135 | } 136 | 137 | throw new NoSuchAlgorithmException("No X509TrustManager in TrustManagerFactory"); 138 | } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/ssl/SSLInitializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.ssl; 31 | 32 | import static net.sf.jsignpdf.Constants.LOGGER; 33 | 34 | import java.io.IOException; 35 | import java.security.KeyManagementException; 36 | import java.security.KeyStore; 37 | import java.security.KeyStoreException; 38 | import java.security.NoSuchAlgorithmException; 39 | import java.security.UnrecoverableKeyException; 40 | import java.security.cert.CertificateException; 41 | 42 | import javax.net.ssl.HostnameVerifier; 43 | import javax.net.ssl.HttpsURLConnection; 44 | import javax.net.ssl.KeyManager; 45 | import javax.net.ssl.KeyManagerFactory; 46 | import javax.net.ssl.SSLContext; 47 | import javax.net.ssl.SSLSession; 48 | import javax.net.ssl.TrustManager; 49 | 50 | import net.sf.jsignpdf.BasicSignerOptions; 51 | import net.sf.jsignpdf.Constants; 52 | import net.sf.jsignpdf.types.ServerAuthentication; 53 | import net.sf.jsignpdf.utils.KeyStoreUtils; 54 | 55 | import org.apache.commons.lang3.StringUtils; 56 | 57 | /** 58 | * Helper class for handling default SSL connections settings (HTTPS). 59 | * 60 | * @author Josef Cacek 61 | */ 62 | public class SSLInitializer { 63 | 64 | private static final TrustManager[] TRUST_MANAGERS = new TrustManager[] { new DynamicX509TrustManager() }; 65 | 66 | public static final void init() 67 | throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, CertificateException, IOException { 68 | if (Constants.RELAX_SSL_SECURITY) { 69 | LOGGER.fine("Relaxing SSL security."); 70 | 71 | // Details for the properties - 72 | // http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html 73 | // Workaround for 74 | // http://sourceforge.net/tracker/?func=detail&atid=1037906&aid=3491269&group_id=216921 75 | System.setProperty("jsse.enableSNIExtension", "false"); 76 | 77 | // just in case... 78 | System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true"); 79 | System.setProperty("sun.security.ssl.allowLegacyHelloMessages", "true"); 80 | 81 | HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { 82 | @Override 83 | public boolean verify(String hostname, SSLSession session) { 84 | return true; 85 | } 86 | }); 87 | } 88 | 89 | SSLContext sslContext = SSLContext.getInstance("TLS"); 90 | sslContext.init(null, TRUST_MANAGERS, null); 91 | 92 | HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); 93 | } 94 | 95 | /** 96 | * @param options 97 | * @throws NoSuchAlgorithmException 98 | * @throws IOException 99 | * @throws CertificateException 100 | * @throws KeyStoreException 101 | * @throws KeyManagementException 102 | * @throws UnrecoverableKeyException 103 | */ 104 | public static void init(BasicSignerOptions options) throws NoSuchAlgorithmException, KeyManagementException, 105 | KeyStoreException, CertificateException, IOException, UnrecoverableKeyException { 106 | KeyManager[] km = null; 107 | if (options != null && options.getTsaServerAuthn() == ServerAuthentication.CERTIFICATE) { 108 | char[] pwd = null; 109 | if (StringUtils.isNotEmpty(options.getTsaCertFilePwd())) { 110 | pwd = options.getTsaCertFilePwd().toCharArray(); 111 | } 112 | LOGGER.info(Constants.RES.get("ssl.keymanager.init", options.getTsaCertFile())); 113 | final String ksType = StringUtils.defaultIfBlank(options.getTsaCertFileType(), "PKCS12"); 114 | KeyStore keyStore = KeyStoreUtils.loadKeyStore(ksType, options.getTsaCertFile(), pwd); 115 | KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); 116 | keyManagerFactory.init(keyStore, pwd); 117 | km = keyManagerFactory.getKeyManagers(); 118 | } 119 | SSLContext sslContext = SSLContext.getInstance("TLS"); 120 | sslContext.init(km, TRUST_MANAGERS, null); 121 | 122 | HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/types/CertificationLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.types; 31 | 32 | import static net.sf.jsignpdf.Constants.RES; 33 | 34 | import com.lowagie.text.pdf.PdfSignatureAppearance; 35 | 36 | /** 37 | * Enum of possible certification levels used to Sign PDF. 38 | * 39 | * @author Josef Cacek 40 | */ 41 | public enum CertificationLevel { 42 | 43 | NOT_CERTIFIED("certificationLevel.notCertified", PdfSignatureAppearance.NOT_CERTIFIED), CERTIFIED_NO_CHANGES_ALLOWED( 44 | "certificationLevel.noChanges", 45 | PdfSignatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED), CERTIFIED_FORM_FILLING("certificationLevel.formFill", 46 | PdfSignatureAppearance.CERTIFIED_FORM_FILLING), CERTIFIED_FORM_FILLING_AND_ANNOTATIONS( 47 | "certificationLevel.formFillAnnot", PdfSignatureAppearance.CERTIFIED_FORM_FILLING_AND_ANNOTATIONS); 48 | 49 | private String msgKey; 50 | private int level; 51 | 52 | CertificationLevel(final String aMsgKey, final int aLevel) { 53 | msgKey = aMsgKey; 54 | level = aLevel; 55 | } 56 | 57 | /** 58 | * Returns internationalized description of a level. 59 | */ 60 | public String toString() { 61 | return RES.get(msgKey); 62 | } 63 | 64 | /** 65 | * Returns Level as defined in iText. 66 | * 67 | * @return 68 | * @see PdfSignatureAppearance#setCertificationLevel(int) 69 | */ 70 | public int getLevel() { 71 | return level; 72 | } 73 | 74 | /** 75 | * Returns {@link CertificationLevel} instance for given code. If the code is not found, 76 | * {@link CertificationLevel#NOT_CERTIFIED} is returned. 77 | * 78 | * @param certLevelCode level code 79 | * @return not-null CertificationLevel instance 80 | */ 81 | public static CertificationLevel findCertificationLevel(int certLevelCode) { 82 | for (CertificationLevel certLevel : values()) { 83 | if (certLevelCode == certLevel.getLevel()) { 84 | return certLevel; 85 | } 86 | } 87 | return NOT_CERTIFIED; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/types/HashAlgorithm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.types; 31 | 32 | import static java.util.stream.Collectors.joining; 33 | import static net.sf.jsignpdf.types.PdfVersion.PDF_1_3; 34 | import static net.sf.jsignpdf.types.PdfVersion.PDF_1_6; 35 | import static net.sf.jsignpdf.types.PdfVersion.PDF_1_7; 36 | 37 | import java.util.stream.Collectors; 38 | import java.util.stream.Stream; 39 | 40 | /** 41 | * Enum of hash algorithms supported in PDF signatures. 42 | * 43 | * @author Josef Cacek 44 | */ 45 | public enum HashAlgorithm { 46 | SHA1("SHA-1", PDF_1_3), SHA256("SHA-256", PDF_1_6), SHA384("SHA-384", PDF_1_7), SHA512("SHA-512", 47 | PDF_1_7), RIPEMD160("RIPEMD160", PDF_1_7); 48 | 49 | private final PdfVersion pdfVersion; 50 | private final String algorithmName; 51 | 52 | private HashAlgorithm(final String aName, PdfVersion aVersion) { 53 | algorithmName = aName; 54 | pdfVersion = aVersion; 55 | } 56 | 57 | /** 58 | * Gets algorithm name. 59 | */ 60 | public String getAlgorithmName() { 61 | return algorithmName; 62 | } 63 | 64 | /** 65 | * Gets minimal PDF version supporting the algorithm. 66 | */ 67 | public PdfVersion getPdfVersion() { 68 | return pdfVersion; 69 | } 70 | 71 | public String toStringWithPdfVersion() { 72 | return algorithmName + " (" + pdfVersion.getVersionName() + ")"; 73 | } 74 | 75 | public static String valuesWithPdfVersionAsString() { 76 | return Stream.of(values()).map(ha -> ha.toStringWithPdfVersion()).collect(joining(", ")); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/types/PDFEncryption.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.types; 31 | 32 | import static net.sf.jsignpdf.Constants.RES; 33 | 34 | /** 35 | * PDF encryption type. 36 | * 37 | * @author Josef Cacek 38 | */ 39 | public enum PDFEncryption { 40 | NONE("pdfEncryption.notEncrypted"), PASSWORD("pdfEncryption.password"), CERTIFICATE("pdfEncryption.certificate"); 41 | 42 | private String msgKey; 43 | 44 | PDFEncryption(final String aMsgKey) { 45 | msgKey = aMsgKey; 46 | } 47 | 48 | /** 49 | * Returns internationalized description of a level. 50 | */ 51 | @Override 52 | public String toString() { 53 | return RES.get(msgKey); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/types/PageInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.types; 31 | 32 | /** 33 | * PDF page info. 34 | * 35 | * @author Josef Cacek 36 | */ 37 | public class PageInfo { 38 | 39 | private final float width; 40 | private final float height; 41 | 42 | public PageInfo(float width, float height) { 43 | this.width = width; 44 | this.height = height; 45 | } 46 | 47 | public float getWidth() { 48 | return width; 49 | } 50 | 51 | public float getHeight() { 52 | return height; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/types/PdfVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.types; 31 | 32 | import com.lowagie.text.pdf.PdfWriter; 33 | 34 | /** 35 | * Enum of PDF versions 36 | * 37 | * @author Josef Cacek 38 | */ 39 | public enum PdfVersion { 40 | PDF_1_2("PDF-1.2", PdfWriter.VERSION_1_2), PDF_1_3("PDF-1.3", PdfWriter.VERSION_1_3), PDF_1_4("PDF-1.4", 41 | PdfWriter.VERSION_1_4), PDF_1_5("PDF-1.5", PdfWriter.VERSION_1_5), PDF_1_6("PDF-1.6", 42 | PdfWriter.VERSION_1_6), PDF_1_7("PDF-1.7", PdfWriter.VERSION_1_7); 43 | 44 | private final String name; 45 | private final char charVersion; 46 | 47 | private PdfVersion(final String aName, char aVersion) { 48 | name = aName; 49 | charVersion = aVersion; 50 | } 51 | 52 | /** 53 | * Gets version name. 54 | */ 55 | public String getVersionName() { 56 | return name; 57 | } 58 | 59 | /** 60 | * Gets version as char (representation in PdfReader and PdfWriter). 61 | */ 62 | public char getCharVersion() { 63 | return charVersion; 64 | } 65 | 66 | public static PdfVersion fromCharVersion(char ver) { 67 | for (PdfVersion pdfVer: PdfVersion.values()) { 68 | if (pdfVer.getCharVersion() == ver) { 69 | return pdfVer; 70 | } 71 | } 72 | return null; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/types/PrintRight.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.types; 31 | 32 | import static net.sf.jsignpdf.Constants.RES; 33 | 34 | import com.lowagie.text.pdf.PdfWriter; 35 | 36 | /** 37 | * Enum of possible printing rights 38 | * 39 | * @author Josef Cacek 40 | */ 41 | public enum PrintRight { 42 | 43 | DISALLOW_PRINTING("rights.disallowPrinting", 0), ALLOW_DEGRADED_PRINTING("rights.allowDegradedPrinting", 44 | PdfWriter.ALLOW_DEGRADED_PRINTING), ALLOW_PRINTING("rights.allowPrinting", PdfWriter.ALLOW_PRINTING); 45 | 46 | private String msgKey; 47 | private int right; 48 | 49 | PrintRight(final String aMsgKey, final int aLevel) { 50 | msgKey = aMsgKey; 51 | right = aLevel; 52 | } 53 | 54 | /** 55 | * Returns internationalized description of a right. 56 | */ 57 | public String toString() { 58 | return RES.get(msgKey); 59 | } 60 | 61 | /** 62 | * Returns right (bit mask) as defined in iText. 63 | * 64 | * @return 65 | * @see PdfWriter#ALLOW_PRINTING 66 | */ 67 | public int getRight() { 68 | return right; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/types/RelRect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.types; 31 | 32 | import java.awt.Dimension; 33 | import java.awt.Point; 34 | import java.beans.PropertyChangeListener; 35 | import java.util.Arrays; 36 | 37 | import net.sf.jsignpdf.preview.FinalPropertyChangeSupport; 38 | 39 | /** 40 | * Rectangle implementation based on relative positions. 41 | * 42 | * @author Josef Cacek 43 | */ 44 | public class RelRect { 45 | 46 | public static final String PROPERTY_COORDS = "coords"; 47 | 48 | private final Float[] coords = new Float[] { 0f, 0f, 1f, 1f }; 49 | private Dimension imageSize = new Dimension(1, 1); 50 | 51 | private FinalPropertyChangeSupport pcs = new FinalPropertyChangeSupport(this); 52 | 53 | /** 54 | * Return if the rectangle is valid (i.e. both startPoint and endPoint are set correctly) 55 | * 56 | * @return true if valid, false otherwise 57 | */ 58 | public boolean isValid() { 59 | for (Float tmpCoord : coords) { 60 | if (tmpCoord == null) 61 | return false; 62 | } 63 | return true; 64 | } 65 | 66 | /** 67 | * Returns startPoint coordinates in the image. 68 | * 69 | * @return 70 | */ 71 | public int[] getP1() { 72 | return makeImgPoint(0); 73 | } 74 | 75 | /** 76 | * Returns endPoint coordinates in the image. 77 | * 78 | * @return 79 | */ 80 | public int[] getP2() { 81 | return makeImgPoint(2); 82 | } 83 | 84 | /** 85 | * Sets the start Point 86 | * 87 | * @param aPoint the startPoint to set 88 | */ 89 | public void setStartPoint(Point aPoint) { 90 | setRelPoint(aPoint, 0); 91 | } 92 | 93 | /** 94 | * Returns relative coordinates of the startPoint [x1,y1] and endPoint [x2,y2] as Float array [x1,y1,x2,y2] 95 | * 96 | * @return 97 | */ 98 | public Float[] getCoords() { 99 | return coords; 100 | } 101 | 102 | /** 103 | * Sets the end Point 104 | * 105 | * @param aPoint the endPoint to set 106 | */ 107 | public void setEndPoint(Point aPoint) { 108 | setRelPoint(aPoint, 2); 109 | } 110 | 111 | /** 112 | * Sets new dimension. Minimal values for both sizes (width, height) are [1,1] 113 | * 114 | * @param newWidth 115 | * @param newHeight 116 | */ 117 | public void setImgSize(int newWidth, int newHeight) { 118 | if (newWidth < 1) 119 | newWidth = 1; 120 | if (newHeight < 1) 121 | newHeight = 1; 122 | 123 | imageSize.setSize(newWidth, newHeight); 124 | } 125 | 126 | /** 127 | * Adds propertyChangeListener for this bean 128 | * 129 | * @param listener 130 | */ 131 | public void addPropertyChangeListener(PropertyChangeListener listener) { 132 | this.pcs.addPropertyChangeListener(listener); 133 | } 134 | 135 | /** 136 | * Removes propertyChangeListener from this bean 137 | * 138 | * @param listener 139 | */ 140 | public void removePropertyChangeListener(PropertyChangeListener listener) { 141 | this.pcs.removePropertyChangeListener(listener); 142 | } 143 | 144 | /** 145 | * Calculates point in the image. 146 | * 147 | * @param coordsOffset use 0 for startPoint and 2 for endPoint. 148 | * @return coordinates [x,y] of a point in the image 149 | */ 150 | private int[] makeImgPoint(int coordsOffset) { 151 | int x = Math.round(coords[coordsOffset] * imageSize.width); 152 | int y = imageSize.height - Math.round(coords[coordsOffset + 1] * imageSize.height); 153 | return new int[] { x, y }; 154 | } 155 | 156 | /** 157 | * Sets coordinates of a relative point (startPoint or endPoint) based on given Point in the image. 158 | * 159 | * @param point point with coordinates in the image 160 | * @param offset use 0 for startPoint and 2 for endPoint. 161 | */ 162 | private void setRelPoint(Point point, int offset) { 163 | final Float[] oldVal = Arrays.copyOf(coords, coords.length); 164 | if (point == null) { 165 | coords[offset] = null; 166 | coords[offset + 1] = null; 167 | } else { 168 | coords[offset] = (float) point.x / imageSize.width; 169 | coords[offset + 1] = 1f - (float) point.y / imageSize.height; 170 | } 171 | pcs.firePropertyChange(PROPERTY_COORDS, oldVal, coords); 172 | } 173 | 174 | } 175 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/types/RenderMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.types; 31 | 32 | import static net.sf.jsignpdf.Constants.RES; 33 | 34 | import com.lowagie.text.pdf.PdfSignatureAppearance; 35 | 36 | /** 37 | * Enum for visible sign rendering configuration 38 | * 39 | * @author Josef Cacek 40 | */ 41 | public enum RenderMode { 42 | 43 | DESCRIPTION_ONLY("render.descriptionOnly", PdfSignatureAppearance.SignatureRenderDescription), GRAPHIC_AND_DESCRIPTION( 44 | "render.graphicAndDescription", 45 | PdfSignatureAppearance.SignatureRenderGraphicAndDescription), SIGNAME_AND_DESCRIPTION( 46 | "render.signameAndDescription", PdfSignatureAppearance.SignatureRenderNameAndDescription); 47 | 48 | private String msgKey; 49 | private int render; 50 | 51 | RenderMode(final String aMsgKey, final int aLevel) { 52 | msgKey = aMsgKey; 53 | render = aLevel; 54 | } 55 | 56 | /** 57 | * Returns internationalized description of a right. 58 | */ 59 | @Override 60 | public String toString() { 61 | return RES.get(msgKey); 62 | } 63 | 64 | /** 65 | * Returns Visible Signature Render flag. 66 | * 67 | * @return integer flag 68 | * @see PdfSignatureAppearance#setRender(int) 69 | */ 70 | public int getRender() { 71 | return render; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/types/ServerAuthentication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.types; 31 | 32 | import static net.sf.jsignpdf.Constants.RES; 33 | 34 | /** 35 | * A server authentication methods enum. 36 | * 37 | * @author Josef Cacek 38 | */ 39 | public enum ServerAuthentication { 40 | NONE("serverAuthn.none"), PASSWORD("serverAuthn.password"), CERTIFICATE("serverAuthn.certificate"); 41 | 42 | private String msgKey; 43 | 44 | ServerAuthentication(final String aMsgKey) { 45 | msgKey = aMsgKey; 46 | } 47 | 48 | /** 49 | * Returns internationalized description of a level. 50 | */ 51 | @Override 52 | public String toString() { 53 | return RES.get(msgKey); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/utils/ConfigProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.utils; 31 | 32 | import net.sf.jsignpdf.Constants; 33 | 34 | import java.io.File; 35 | 36 | import static net.sf.jsignpdf.Constants.LOGGER; 37 | 38 | /** 39 | * Property holder for tweak file. 40 | * 41 | * @author Josef Cacek 42 | */ 43 | public class ConfigProvider extends PropertyProvider { 44 | 45 | protected ConfigProvider() { 46 | } 47 | 48 | /** 49 | * Returns instance of this class. (singleton) 50 | * 51 | * @return 52 | */ 53 | public static ConfigProvider getInstance() { 54 | return InstanceHolder.INSTANCE; 55 | } 56 | 57 | /* 58 | * (non-Javadoc) 59 | * 60 | * @see net.sf.jsignpdf.PropertyProvider#loadDefault() 61 | */ 62 | @Override 63 | public void loadDefault() throws ProperyProviderException { 64 | File file = IOUtils.findFile(Constants.CONF_FILE); 65 | if (file != null && file.isFile()) { 66 | loadProperties(file); 67 | } else { 68 | LOGGER.fine("Config file " + file + " doesn't exists."); 69 | } 70 | } 71 | 72 | private static class InstanceHolder { 73 | static final ConfigProvider INSTANCE = new ConfigProvider(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/utils/FontUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.utils; 31 | 32 | import java.io.ByteArrayOutputStream; 33 | import java.io.File; 34 | import java.io.FileInputStream; 35 | import java.io.InputStream; 36 | 37 | import net.sf.jsignpdf.Constants; 38 | 39 | import org.apache.commons.io.IOUtils; 40 | 41 | import com.lowagie.text.pdf.BaseFont; 42 | 43 | /** 44 | * Utilities for handling fonts in visible signature. 45 | * 46 | * @author Josef Cacek 47 | */ 48 | public class FontUtils { 49 | 50 | public static BaseFont l2baseFont; 51 | 52 | /** 53 | * Returns BaseFont for text of visible signature; 54 | * 55 | * @return 56 | */ 57 | public static synchronized BaseFont getL2BaseFont() { 58 | if (l2baseFont == null) { 59 | final ConfigProvider conf = ConfigProvider.getInstance(); 60 | try { 61 | final ByteArrayOutputStream tmpBaos = new ByteArrayOutputStream(); 62 | String fontPath = conf.getNotEmptyProperty("font.path", null); 63 | String fontName; 64 | String fontEncoding; 65 | InputStream tmpIs; 66 | if (fontPath != null) { 67 | fontName = conf.getNotEmptyProperty("font.name", null); 68 | if (fontName == null) { 69 | fontName = new File(fontPath).getName(); 70 | } 71 | fontEncoding = conf.getNotEmptyProperty("font.encoding", null); 72 | if (fontEncoding == null) { 73 | fontEncoding = BaseFont.WINANSI; 74 | } 75 | tmpIs = new FileInputStream(fontPath); 76 | } else { 77 | fontName = Constants.L2TEXT_FONT_NAME; 78 | fontEncoding = BaseFont.IDENTITY_H; 79 | tmpIs = FontUtils.class.getResourceAsStream(Constants.L2TEXT_FONT_PATH); 80 | } 81 | IOUtils.copy(tmpIs, tmpBaos); 82 | tmpIs.close(); 83 | tmpBaos.close(); 84 | l2baseFont = BaseFont.createFont(fontName, fontEncoding, BaseFont.EMBEDDED, BaseFont.CACHED, 85 | tmpBaos.toByteArray(), null); 86 | } catch (Exception e) { 87 | e.printStackTrace(); 88 | try { 89 | l2baseFont = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED); 90 | } catch (Exception ex) { 91 | // where is the problem, dear Watson? 92 | } 93 | } 94 | } 95 | return l2baseFont; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/utils/GuiUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.utils; 31 | 32 | import java.awt.Component; 33 | import java.awt.Dimension; 34 | import java.awt.GraphicsDevice; 35 | import java.awt.GraphicsEnvironment; 36 | 37 | /** 38 | * Helper class for swing GUI (window, component) manipulation 39 | * 40 | * @author Josef Cacek 41 | */ 42 | public class GuiUtils { 43 | 44 | /** 45 | * Locates the given component on the screen's center. 46 | * 47 | * @param component the component to be centered 48 | */ 49 | public static void center(final Component component) { 50 | final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); 51 | final int screenWidth = gd.getDisplayMode().getWidth(); 52 | final int screenHeight = gd.getDisplayMode().getHeight(); 53 | final Dimension paneSize = component.getSize(); 54 | component.setLocation((screenWidth - paneSize.width) / 2, (int) ((screenHeight - paneSize.height) * 0.45)); 55 | } 56 | 57 | /** 58 | * Sets component size to cca 80% of screen size and centers window. 59 | * 60 | * @param component 61 | */ 62 | public static void resizeAndCenter(final Component component) { 63 | final GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); 64 | final int screenWidth = gd.getDisplayMode().getWidth(); 65 | final int screenHeight = gd.getDisplayMode().getHeight(); 66 | component.setSize((int) (screenWidth * 0.8), (int) (screenHeight * 0.8)); 67 | center(component); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/utils/IOUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.utils; 31 | 32 | import static net.sf.jsignpdf.Constants.ENV_JSIGNPDF_HOME; 33 | import static net.sf.jsignpdf.Constants.SYSPROP_JSIGNPDF_HOME; 34 | 35 | import java.io.File; 36 | 37 | import net.sf.jsignpdf.Constants; 38 | 39 | /** 40 | * IO and file utils. 41 | * 42 | * @author Josef Cacek 43 | */ 44 | public class IOUtils { 45 | 46 | /** 47 | * Finds given filepath within JSignPdf home - checking the alternative locations first. 48 | * 49 | * @see Constants#SYSPROP_JSIGNPDF_HOME 50 | * @see Constants#ENV_JSIGNPDF_HOME 51 | */ 52 | public static File findFile(String filePath) { 53 | File file = getIfExists(filePath, SYSPROP_JSIGNPDF_HOME); 54 | if (file == null) { 55 | file = getIfExists(filePath, ENV_JSIGNPDF_HOME); 56 | if (file == null) { 57 | file = new File(filePath); 58 | } 59 | } 60 | return file; 61 | } 62 | 63 | private static File getIfExists(String filePath, String jsignpdfHomeDir) { 64 | if (jsignpdfHomeDir == null) { 65 | return null; 66 | } 67 | File file = new File(jsignpdfHomeDir, filePath); 68 | return file.isFile() && file.canRead() ? file : null; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/utils/PKCS11Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.utils; 31 | 32 | import static net.sf.jsignpdf.Constants.LOGGER; 33 | 34 | import java.io.File; 35 | import java.security.KeyStore; 36 | import java.security.Provider; 37 | import java.security.Security; 38 | import java.util.logging.Level; 39 | 40 | import org.apache.commons.lang3.StringUtils; 41 | 42 | /** 43 | * Methods for handling PKCS#11 security providers. 44 | * 45 | * @author Josef Cacek 46 | */ 47 | public class PKCS11Utils { 48 | 49 | public static volatile Provider SUN_PROVIDER; 50 | public static volatile Provider JSIGN_PROVIDER; 51 | 52 | /** 53 | * Tries to register the sun.security.pkcs11.SunPKCS11 provider with configuration provided in the given file. 54 | * 55 | * @param configPath path to PKCS#11 provider configuration file 56 | * @return newly registered PKCS#11 provider name if provider successfully registered; null otherwise 57 | */ 58 | public static void registerProviders(final String configPath) { 59 | if (StringUtils.isEmpty(configPath)) { 60 | return; 61 | } 62 | LOGGER.fine("Registering SunPKCS11 provider from configuration in " + configPath); 63 | final File cfgFile = IOUtils.findFile(configPath); 64 | final String absolutePath = cfgFile.getAbsolutePath(); 65 | if (cfgFile.isFile()) { 66 | SUN_PROVIDER = initPkcs11Provider(absolutePath, "sun.security.pkcs11.SunPKCS11"); 67 | JSIGN_PROVIDER = initPkcs11Provider(absolutePath, "com.github.kwart.jsign.pkcs11.JSignPKCS11"); 68 | } else { 69 | System.err.println("The PKCS#11 provider is not registered. Configuration file doesn't exist: " + absolutePath); 70 | } 71 | } 72 | 73 | /** 74 | * Unregisters PKCS11 security provider registered by {@link #registerProviders(String)} method. 75 | *

76 | * Some tokens/card-readers hangs during second usage of the program, they have to be unplugged and plugged again following 77 | * code should prevent this issue. 78 | *

79 | * 80 | * @param providerName 81 | */ 82 | public static void unregisterProviders() { 83 | SUN_PROVIDER = unregisterProvider(SUN_PROVIDER); 84 | JSIGN_PROVIDER = unregisterProvider(JSIGN_PROVIDER); 85 | // we should wait a little bit to de-register provider correctly (is it a driver 86 | // issue?) 87 | try { 88 | Thread.sleep(1000); 89 | } catch (InterruptedException e) { 90 | e.printStackTrace(); 91 | } 92 | } 93 | 94 | public static String getProviderNameForKeystoreType(String type) { 95 | if (type == null) { 96 | return null; 97 | } 98 | String name = getProviderNameImpl(type, SUN_PROVIDER); 99 | if (name == null) { 100 | name = getProviderNameImpl(type, JSIGN_PROVIDER); 101 | } 102 | return name; 103 | } 104 | 105 | private static Provider initPkcs11Provider(String configPath, String className) { 106 | Provider pkcs11Provider = null; 107 | try { 108 | Class sunPkcs11Cls = Class.forName(className); 109 | try { 110 | pkcs11Provider = (Provider) sunPkcs11Cls.getConstructor(String.class).newInstance(configPath); 111 | } catch (NoSuchMethodException e) { 112 | pkcs11Provider = (Provider) sunPkcs11Cls.getConstructor().newInstance(); 113 | Class provCls = Provider.class; 114 | pkcs11Provider = (Provider) provCls.getMethod("configure", String.class).invoke(pkcs11Provider, configPath); 115 | } 116 | Security.addProvider(pkcs11Provider); 117 | final String name = pkcs11Provider.getName(); 118 | LOGGER.fine("PKCS11 provider registered with name " + name); 119 | } catch (Throwable e) { 120 | LOGGER.log(Level.SEVERE, "Unable to register SunPKCS11 security provider.", e); 121 | } 122 | return pkcs11Provider; 123 | } 124 | 125 | private static Provider unregisterProvider(Provider provider) { 126 | if (provider == null) { 127 | return null; 128 | } 129 | String providerName = provider.getName(); 130 | LOGGER.fine("Removing security provider with name " + providerName); 131 | try { 132 | Security.removeProvider(providerName); 133 | } catch (Exception e) { 134 | LOGGER.log(Level.SEVERE, "Removing provider failed", e); 135 | } 136 | return null; 137 | } 138 | 139 | private static String getProviderNameImpl(String type, Provider provider) { 140 | if (provider == null || type == null) { 141 | return null; 142 | } 143 | String providerName = provider.getName(); 144 | try { 145 | KeyStore.getInstance(type, provider); 146 | LOGGER.fine("KeyStore type " + type + " is supported by the provider " + providerName); 147 | return provider.getName(); 148 | } catch (Exception e) { 149 | LOGGER.fine("KeyStore type " + type + " is not supported by the provider " + providerName); 150 | } 151 | return null; 152 | } 153 | 154 | } 155 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/utils/PdfUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.utils; 31 | 32 | import java.io.IOException; 33 | 34 | import com.lowagie.text.pdf.PdfReader; 35 | 36 | /** 37 | * Utilities to handle PDFs. 38 | * 39 | * @author Josef Cacek 40 | */ 41 | public class PdfUtils { 42 | 43 | /** 44 | * It tries to create PDF reader in 3 steps: 45 | *
    46 | *
  • without password
  • 47 | *
  • with empty password
  • 48 | *
  • with given password
  • 49 | *
50 | * 51 | * @param aFileName file name of PDF 52 | * @param aPassword password 53 | * @return 54 | * @throws IOException 55 | */ 56 | public static PdfReader getPdfReader(final String aFileName, byte[] aPassword) throws IOException { 57 | PdfReader tmpReader = null; 58 | try { 59 | // try to read without password 60 | tmpReader = new PdfReader(aFileName); 61 | } catch (Exception e) { 62 | try { 63 | tmpReader = new PdfReader(aFileName, new byte[0]); 64 | } catch (Exception e2) { 65 | tmpReader = new PdfReader(aFileName, aPassword); 66 | } 67 | } 68 | return tmpReader; 69 | } 70 | 71 | /** 72 | * It tries to create PDF reader in 3 steps: 73 | *
    74 | *
  • without password
  • 75 | *
  • with empty password
  • 76 | *
  • with given password
  • 77 | *
78 | * 79 | * @param content content of PDF 80 | * @param aPassword password 81 | * @return 82 | * @throws IOException 83 | */ 84 | public static PdfReader getPdfReader(final byte[] content, byte[] aPassword) throws IOException { 85 | PdfReader tmpReader = null; 86 | try { 87 | // try to read without password 88 | tmpReader = new PdfReader(content); 89 | } catch (Exception e) { 90 | try { 91 | tmpReader = new PdfReader(content, new byte[0]); 92 | } catch (Exception e2) { 93 | tmpReader = new PdfReader(content, aPassword); 94 | } 95 | } 96 | return tmpReader; 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /jsignpdf/src/main/java/net/sf/jsignpdf/utils/ResourceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | * 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | * 12 | * The Original Code is 'JSignPdf, a free application for PDF signing'. 13 | * 14 | * The Initial Developer of the Original Code is Josef Cacek. 15 | * Portions created by Josef Cacek are Copyright (C) Josef Cacek. All Rights Reserved. 16 | * 17 | * Contributor(s): Josef Cacek. 18 | * 19 | * Alternatively, the contents of this file may be used under the terms 20 | * of the GNU Lesser General Public License, version 2.1 (the "LGPL License"), in which case the 21 | * provisions of LGPL License are applicable instead of those 22 | * above. If you wish to allow use of your version of this file only 23 | * under the terms of the LGPL License and not to allow others to use 24 | * your version of this file under the MPL, indicate your decision by 25 | * deleting the provisions above and replace them with the notice and 26 | * other provisions required by the LGPL License. If you do not delete 27 | * the provisions above, a recipient may use your version of this file 28 | * under either the MPL or the LGPL License. 29 | */ 30 | package net.sf.jsignpdf.utils; 31 | 32 | import static net.sf.jsignpdf.Constants.LOGGER; 33 | 34 | import java.text.MessageFormat; 35 | import java.util.MissingResourceException; 36 | import java.util.ResourceBundle; 37 | import java.util.logging.Level; 38 | 39 | import javax.swing.AbstractButton; 40 | import javax.swing.JComponent; 41 | import javax.swing.JLabel; 42 | import javax.swing.JPanel; 43 | import javax.swing.border.TitledBorder; 44 | 45 | 46 | /** 47 | * Entry point to internationalization. Resource bundles has base "translation/messages". 48 | * 49 | * @author Josef Cacek [josef.cacek (at) gmail.com] 50 | * @author $Author: kwart $ 51 | * @version $Revision: 1.5 $ 52 | * @created $Date: 2012/05/01 13:41:17 $ 53 | */ 54 | public class ResourceProvider { 55 | 56 | private ResourceBundle bundle; 57 | 58 | /** 59 | * Constructor which takes a not-null {@link ResourceBundle} as an argument. 60 | * 61 | * @param bundle 62 | */ 63 | public ResourceProvider(ResourceBundle bundle) { 64 | if (bundle == null) { 65 | throw new IllegalArgumentException("ResourceBundle must be not-null."); 66 | } 67 | this.bundle = bundle; 68 | } 69 | 70 | /** 71 | * Sets translations and mnemonics for labels and different kind of buttons 72 | * 73 | * @param aComponent component in which should be label set 74 | * @param aKey message key 75 | */ 76 | public void setLabelAndMnemonic(final JComponent aComponent, final String aKey) { 77 | final String tmpLabelText = get(aKey); 78 | final int tmpMnemIndex = getMnemonicIndex(aKey); 79 | if (aComponent instanceof JLabel) { 80 | final JLabel tmpLabel = (JLabel) aComponent; 81 | tmpLabel.setText(tmpLabelText); 82 | if (tmpMnemIndex > -1) { 83 | tmpLabel.setDisplayedMnemonic(tmpLabelText.toLowerCase().charAt(tmpMnemIndex)); 84 | tmpLabel.setDisplayedMnemonicIndex(tmpMnemIndex); 85 | } 86 | } else if (aComponent instanceof AbstractButton) { 87 | // handles Buttons, Checkboxes and Radiobuttons 88 | final AbstractButton tmpBtn = (AbstractButton) aComponent; 89 | tmpBtn.setText(tmpLabelText); 90 | if (tmpMnemIndex > -1) { 91 | tmpBtn.setMnemonic(tmpLabelText.toLowerCase().charAt(tmpMnemIndex)); 92 | } 93 | } else if (aComponent instanceof JPanel) { 94 | final JPanel panel = (JPanel) aComponent; 95 | if (panel.getBorder() instanceof TitledBorder) { 96 | final TitledBorder titledBorder = (TitledBorder) panel.getBorder(); 97 | titledBorder.setTitle(tmpLabelText); 98 | } 99 | } else { 100 | throw new IllegalArgumentException(); 101 | } 102 | } 103 | 104 | /** 105 | * Returns message for given key from active ResourceBundle 106 | * 107 | * @param aKey name of key in resource bundle 108 | * @return message for given key 109 | */ 110 | public String get(final String aKey) { 111 | String tmpMessage = null; 112 | try { 113 | tmpMessage = bundle.getString(aKey); 114 | } catch (MissingResourceException e) { 115 | LOGGER.log(Level.WARNING, "Missing resource " + aKey, e); 116 | } 117 | if (tmpMessage == null) { 118 | tmpMessage = aKey; 119 | } else { 120 | tmpMessage = tmpMessage.replaceAll("&([^&])", "$1"); 121 | } 122 | return tmpMessage; 123 | } 124 | 125 | /** 126 | * Returns index of character which should be used as a mnemonic. It returns -1 if such an character doesn't exist. 127 | * 128 | * @param aKey resource key 129 | * @return index (position) of character in translated message 130 | */ 131 | public int getMnemonicIndex(final String aKey) { 132 | String tmpMessage = null; 133 | try { 134 | tmpMessage = bundle.getString(aKey); 135 | } catch (MissingResourceException e) { 136 | LOGGER.log(Level.WARNING, "Missing resource " + aKey, e); 137 | } 138 | 139 | int tmpResult = -1; 140 | if (tmpMessage != null) { 141 | int searchFrom = 0; 142 | int tmpDoubles = 0; 143 | int tmpPos; 144 | final int tmpLen = tmpMessage.length(); 145 | do { 146 | tmpPos = tmpMessage.indexOf('&', searchFrom); 147 | if (tmpPos == tmpLen - 1) 148 | tmpPos = -1; 149 | if (tmpPos > -1) { 150 | if (tmpMessage.charAt(tmpPos + 1) != '&') { 151 | tmpResult = tmpPos - tmpDoubles; 152 | } else { 153 | searchFrom = tmpPos + 2; 154 | tmpDoubles++; 155 | } 156 | } 157 | } while (tmpPos != -1 && tmpResult == -1 && searchFrom < tmpLen); 158 | } 159 | return tmpResult; 160 | } 161 | 162 | /** 163 | * Returns message for given key from active ResourceBundle and replaces parameters with values given in array. 164 | * 165 | * @param aKey key in resource bundle 166 | * @param anArgs array of parameters to replace in message 167 | * @return message for given key with given arguments 168 | */ 169 | public String get(String aKey, String... anArgs) { 170 | String tmpMessage = get(aKey); 171 | if (aKey == tmpMessage || anArgs == null || anArgs.length == 0) { 172 | return tmpMessage; 173 | } 174 | final MessageFormat tmpFormat = new MessageFormat(tmpMessage); 175 | return tmpFormat.format(anArgs); 176 | } 177 | 178 | } 179 | -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/logging.properties: -------------------------------------------------------------------------------- 1 | handlers=java.util.logging.ConsoleHandler 2 | .level=WARNING 3 | java.util.logging.ConsoleHandler.level=ALL 4 | java.util.logging.SimpleFormatter.format=%4$s %5$s%6$s%n 5 | # Levels: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL 6 | net.sf.jsignpdf.level=FINE 7 | -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/back16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/back16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/clock16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/clock16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/fileopen16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/fileopen16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/fonts/DejaVuSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/fonts/DejaVuSans.ttf -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/fonts/pokrytie.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/fonts/pokrytie.ttf -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/next16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/next16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/options16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/options16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/prev16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/prev16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/preview16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/preview16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/refresh16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/refresh16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/security16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/security16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/signedpdf16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/signedpdf16.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/signedpdf26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/signedpdf26.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/signedpdf32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/main/resources/net/sf/jsignpdf/signedpdf32.png -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/translations/messages_hy.properties: -------------------------------------------------------------------------------- 1 | certificationLevel.notCertified=\u0548\u0579 \u0570\u0561\u057E\u0561\u057F\u0561\u0580\u0574\u0561\u0563\u0580\u057E\u0561\u056E 2 | console.certificateExpired={0} \u057E\u056F\u0561\u0575\u0561\u0563\u0580\u056B \u056A\u0561\u0574\u056F\u0565\u057F\u0576 \u0561\u0580\u0564\u0565\u0576 \u057D\u057A\u0561\u057C\u057E\u0565\u056C \u0567: 3 | console.certificateNotYetValid=\u054E\u056F\u0561\u0575\u0561\u0563\u056B\u0580\u0568 {0} \u0564\u0565\u057C \u057E\u0561\u057E\u0565\u0580 \u0579\u0567: 4 | console.closeStream=\u0531\u0580\u0564\u0575\u0578\u0582\u0576\u0584\u0576\u0565\u0580\u056B PDF \u0570\u0578\u057D\u0584\u0568 \u0583\u0561\u056F\u057E\u0578\u0582\u0574 \u0567 5 | console.createOutPdf=\u0535\u056C\u0584\u0561\u0575\u056B\u0576 PDF \u0586\u0561\u0575\u056C\u056B \u057D\u057F\u0565\u0572\u056E\u0578\u0582\u0574\u055D {0} 6 | console.createSignature=\u054D\u057F\u0578\u0580\u0561\u0563\u0580\u0578\u0582\u0569\u0575\u0561\u0576 \u057D\u057F\u0565\u0572\u056E\u0578\u0582\u0574 7 | console.creatingTsaClient=TSA client-\u056B \u057D\u057F\u0565\u0572\u056E\u0578\u0582\u0574: 8 | certificationLevel.formFill=\u0541\u0587\u0561\u0569\u0572\u0569\u056B \u056C\u0580\u0561\u0581\u0578\u0582\u0574\u0568 \u0569\u0578\u0582\u0575\u056C\u0561\u057F\u0580\u057E\u0578\u0582\u0574 \u0567 9 | certificationLevel.formFillAnnot=\u0541\u0587\u0561\u0569\u0572\u0569\u056B \u056C\u0580\u0561\u0581\u0578\u0582\u0574\u0568 \u0587 \u056E\u0561\u0576\u0578\u0569\u0561\u0563\u0580\u0578\u0582\u0569\u0575\u0578\u0582\u0576\u0576\u0565\u0580\u0568 \u0569\u0578\u0582\u0575\u056C\u0561\u057F\u0580\u057E\u0578\u0582\u0574 \u0565\u0576 10 | certificationLevel.noChanges=\u0548\u0579 \u0574\u056B \u0583\u0578\u0583\u0578\u056D\u0578\u0582\u0569\u0575\u0578\u0582\u0576 \u0579\u056B \u0569\u0578\u0582\u0575\u056C\u0561\u057F\u0580\u057E\u0578\u0582\u0574 11 | console.certificateChainEmpty=\u0531\u0576\u0571\u0576\u0561\u056F\u0561\u0576 \u0562\u0561\u0576\u0561\u056C\u056B \u0579\u056B \u0563\u057F\u0576\u057E\u0565\u056C: \u054D\u057F\u0578\u0582\u0563\u0565\u0584 keystore \u056F\u0561\u0580\u0563\u0561\u057E\u0578\u0580\u0578\u0582\u0574\u0576\u0565\u0580\u0568 (keystore \u057F\u0565\u057D\u0561\u056F\u0568, filepath, password, key alias): 12 | console.certificateNotForSignature=\u054D\u0565\u0580\u057F\u056B\u0586\u056B\u056F\u0561\u057F\u0568 {0} \u0576\u0561\u056D\u0561\u057F\u0565\u057D\u057E\u0561\u056E \u0579\u0567 \u0569\u057E\u0561\u0575\u056B\u0576 \u057D\u057F\u0578\u0580\u0561\u0563\u0580\u0578\u0582\u0569\u0575\u0561\u0576 \u0570\u0561\u0574\u0561\u0580: 13 | console.configureVisible=\u054F\u0565\u057D\u0561\u0576\u0565\u056C\u056B \u057D\u057F\u0578\u0580\u0561\u0563\u0580\u0578\u0582\u0569\u0575\u0561\u0576 \u056F\u0561\u0580\u0563\u0561\u057E\u0578\u0580\u0578\u0582\u0574 14 | console.createImage=\u054A\u0561\u057F\u056F\u0565\u0580\u056B \u057D\u057F\u0565\u0572\u056E\u0578\u0582\u0574 {0} 15 | console.createPdfReader=\u0544\u0578\u0582\u057F\u0584\u0561\u0575\u056B\u0576 PDF \u0586\u0561\u0575\u056C\u056B \u0562\u0561\u0581\u0578\u0582\u0574\u055D {0} 16 | -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/translations/messages_it.properties: -------------------------------------------------------------------------------- 1 | certificationLevel.formFill=Modulo di inserimento consentito 2 | console.certificateChainEmpty=Non e' stata trovata nessuna chiave privata. Controllare le impostazioni del keystore (tipo di keystore, percorso, password, alias chiave). 3 | console.createSignature=Creazione della firma 4 | console.creatingTsaClient=Creazione del client TSA. 5 | console.crlinfo.crlSize=Dimensione della CRL scaricata: {0} 6 | console.crlinfo.retrieveCrlUrl=Lettura dei punti di distribuzione della CRL dal certificato {0} 7 | console.getOCSPURL=Lettura URL OCSP dalla catena di certificati. 8 | console.inFileNotFound.error=Il PDF in ingresso non \u00E8 stato trovato o non \u00E8 leggibile. 9 | console.setAcro6Layers=Utilizzare solo layers consigliati da Acrobat 6: {0} 10 | serverAuthn.password=Nome utente / Password 11 | serverAuthn.none=Senza autenticazione 12 | render.signameAndDescription=Nome e descrizione della firma 13 | console.certificateExpired=Certificato {0} gi\u00E0 scaduto. 14 | certificationLevel.noChanges=Nessuna modifica consentita 15 | console.certificateNotForSignature=Certificato {0} non \u00E8 destinato alla firma digitale. 16 | console.certificateNotYetValid=Certificato {0} non \u00E8 ancora valido. 17 | console.getPrivateKey=Caricamento chiave privata 18 | console.crlinfo.foundCrlUri=Trovato URL CRL nel punto di distribuzione: {0} 19 | console.crlinfo.loadCrl=Scarica CRL da {0} 20 | console.crlinfo.noUrlInDistPoint=Nessun URL HTTP(s) trovato nel punto di distribuzione. 21 | console.noOCSPURL=URL del server OCSP non trovato nel certificato. Verr\u00E0 utilizzato il valore inserito nelle impostazioni dell'applicazione. 22 | console.pdfEncError.wrongCertificateFile=Non \u00E8 possibile utilizzare la crittografia dei certificati del PDF. Il file di certificato "{0}" non pu\u00F2 essere caricato o non contiene un certificato X509. 23 | certificationLevel.formFillAnnot=Inserimento e annotazioni permesse 24 | console.readingCRLs=Lettura delle CRL 25 | -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/translations/messages_ja.properties: -------------------------------------------------------------------------------- 1 | 2 | certificationLevel.formFill = \u30D5\u30A9\u30FC\u30E0\u5165\u529B\u3092\u8A31\u53EF\u3059\u308B 3 | certificationLevel.formFillAnnot = \u30D5\u30A9\u30FC\u30E0\u5165\u529B\u3068\u6CE8\u91C8\u3092\u8A31\u53EF\u3059\u308B 4 | certificationLevel.noChanges = \u3059\u3079\u3066\u306E\u5909\u66F4\u3092\u8A31\u53EF\u3057\u306A\u3044 5 | certificationLevel.notCertified = \u8A3C\u660E\u3057\u306A\u3044 6 | 7 | default.l2text.date = \u7F72\u540D\u65E5\u6642: 8 | default.l2text.location = \u7F72\u540D\u5730: 9 | default.l2text.reason = \u7F72\u540D\u7406\u7531: 10 | default.l2text.signedBy = \u7F72\u540D\u8005: 11 | 12 | gui.advancedView.checkbox = \u8A73\u7D30\u8A2D\u5B9A\u8868\u793A(&D) 13 | gui.alias.label = \u30D5\u30EC\u30F3\u30C9\u30EA\u540D(&A) 14 | gui.appendSignature.checkbox = \u7F72\u540D\u3092\u8FFD\u52A0\u3059\u308B(&G) 15 | gui.browse.button = \u53C2\u7167... 16 | gui.certLevel.label = \u8A3C\u660E\u30EC\u30D9\u30EB(&C) 17 | gui.check.error.title = \u30C1\u30A7\u30C3\u30AF\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002 18 | gui.contact.label = \u9023\u7D61\u5148(&N) 19 | gui.fileNotExists.error = {0} \u306F\u5B58\u5728\u3057\u306A\u3044\u304B\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3002 20 | gui.filesEqual.error = \u5165\u529B\u3068\u51FA\u529B\u3067 PDF \u30D5\u30A1\u30A4\u30EB\u304C\u540C\u3058\u3067\u3059\u3002 21 | gui.hashAlgorithm.label = \u30CF\u30C3\u30B7\u30E5\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0(&H) 22 | gui.inPdfFile.label = \u5165\u529B PDF \u30D5\u30A1\u30A4\u30EB(&I) 23 | gui.info.close.button = \u9589\u3058\u308B 24 | gui.info.title = JSignPdf \u51FA\u529B\u30B3\u30F3\u30BD\u30FC\u30EB 25 | gui.keyPassword.label = \u30AD\u30FC\u30D1\u30B9\u30EF\u30FC\u30C9(&W) 26 | gui.keystoreFile.label = \u30AD\u30FC\u30B9\u30C8\u30A2\u30D5\u30A1\u30A4\u30EB(&K) 27 | gui.keystorePassword.label = \u30AD\u30FC\u30B9\u30C8\u30A2\u30D1\u30B9\u30EF\u30FC\u30C9(&P) 28 | gui.keystoreType.label = \u30AD\u30FC\u30B9\u30C8\u30A2\u30BF\u30A4\u30D7(&T) 29 | gui.loadAliases.button = \u30AD\u30FC\u8AAD\u307F\u8FBC\u307F(&Y) 30 | gui.location.label = \u5834\u6240(&L) 31 | gui.outPdfFile.label = \u51FA\u529B PDF \u30D5\u30A1\u30A4\u30EB(&O) 32 | gui.pdfOwnerPwd.label = \u30DE\u30B9\u30BF\u30D1\u30B9\u30EF\u30FC\u30C9(&N) 33 | gui.pdfUserPwd.label = \u30E6\u30FC\u30B6\u30FC\u30D1\u30B9\u30EF\u30FC\u30C9(&U) 34 | gui.preview.title = \u4F4D\u7F6E\u306E\u78BA\u8A8D 35 | gui.reason.label = \u7F72\u540D\u7406\u7531(&R) 36 | gui.rights.assembly.checkbox = \u6587\u66F8\u30A2\u30BB\u30F3\u30D6\u30EA 37 | gui.rights.button = \u6A29\u9650 38 | gui.rights.copy.checkbox = \u30B3\u30D4\u30FC 39 | gui.rights.fillIn.checkbox = \u30D5\u30A9\u30FC\u30E0\u5165\u529B 40 | gui.rights.modifyAnnotations.checkbox = \u6CE8\u91C8\u306E\u5909\u66F4 41 | gui.rights.modifyContents.checkbox = \u6587\u66F8\u306E\u5909\u66F4 42 | gui.rights.printing.label = \u5370\u5237 43 | gui.rights.rights.label = \u6A29\u9650 44 | gui.rights.screenReaders.checkbox = \u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3 45 | gui.rights.title = \u6A29\u9650 46 | gui.signIt.button = &Sign It 47 | gui.storePasswords.checkbox = \u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8A18\u61B6\u3059\u308B(&M) 48 | gui.title = JSignPdf (version {0}) 49 | gui.tsa.crlEnabled.checkbox = CRL (\u8A3C\u660E\u66F8\u5931\u52B9\u30EA\u30B9\u30C8)\u3092\u6709\u52B9\u306B\u3059\u308B 50 | gui.tsa.enabled.checkbox = TSA (\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u30B5\u30FC\u30D0\u30FC)\u3092\u4F7F\u3046 51 | gui.tsa.ocspEnabled.checkbox = OCSP (\u30AA\u30F3\u30E9\u30A4\u30F3\u5931\u52B9\u78BA\u8A8D)\u3092\u6709\u52B9\u306B\u3059\u308B 52 | gui.tsa.proxy.panel = \u30D7\u30ED\u30AD\u30B7\u8A2D\u5B9A 53 | gui.tsa.proxyHost.label = \u30A2\u30C9\u30EC\u30B9/\u30DD\u30FC\u30C8 54 | gui.tsa.proxyType.label = \u7A2E\u985E 55 | gui.tsa.pwd.label = TSA \u30D1\u30B9\u30EF\u30FC\u30C9 56 | gui.tsa.title = TSA \u3068\u8A3C\u660E\u66F8\u5931\u52B9\u78BA\u8A8D\u306E\u8A2D\u5B9A 57 | gui.tsa.url.label = TSA URL 58 | gui.tsa.user.label = TSA \u30E6\u30FC\u30B6\u30FC 59 | gui.tsaOcsp.button = TSA/OCSP/CRL\u0009 60 | gui.valueNotFilled.error = {0} \u306B\u5165\u529B\u3057\u306A\u3051\u308C\u3070\u3044\u3051\u307E\u305B\u3093\u3002 61 | gui.visibleSignature.checkbox = \u53EF\u8996\u7F72\u540D\u3092\u3059\u308B 62 | gui.visibleSignatureSettings.button = \u8A2D\u5B9A 63 | gui.vs.bgImgPath.label = \u80CC\u666F\u30A4\u30E1\u30FC\u30B8 64 | gui.vs.bgImgScale.label = \u80CC\u666F\u30A4\u30E1\u30FC\u30B8\u306E\u30B9\u30B1\u30FC\u30EB 65 | gui.vs.bgImgScale.tooltip = \u30A4\u30E1\u30FC\u30B8\u30B5\u30A4\u30BA\u306E\u500D\u7387\u306B\u306F\u6B63\u306E\u5024\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\r\n\u30BC\u30ED\u3092\u5165\u529B\u3059\u308B\u3068\u80CC\u666F\u5168\u4F53\u306B\u62E1\u5F35\u3055\u308C\u307E\u3059\u3002\r\n\u8CA0\u306E\u6570\u5B57\u3092\u5165\u529B\u3059\u308B\u3068\u67A0\u306B\u53CE\u307E\u308B\u3088\u3046\u306B\u30EA\u30B5\u30A4\u30BA\u3055\u308C\u307E\u3059\u3002 66 | gui.vs.browse.button = \u53C2\u7167... 67 | gui.vs.close.button = \u9589\u3058\u308B 68 | gui.vs.default.checkbox = \u65E2\u5B9A\u5024 69 | gui.vs.imgPath.label = \u30A4\u30E1\u30FC\u30B8 70 | gui.vs.l2Text.label = \u7F72\u540D\u30C6\u30AD\u30B9\u30C8 71 | gui.vs.l2TextFontSize.label = \u7F72\u540D\u306E\u30D5\u30A9\u30F3\u30C8\u30B5\u30A4\u30BA 72 | gui.vs.l4Text.label = \u30B9\u30C6\u30FC\u30BF\u30B9\u30C6\u30AD\u30B9\u30C8 73 | gui.vs.llx.label = \u5DE6\u4E0B X 74 | gui.vs.llx.tooltip = \u30DA\u30FC\u30B8\u4E0A\u306B\u914D\u7F6E\u3059\u308B\u7F72\u540D\u306E\u5DE6\u4E0B\u89D2\u306E X \u5EA7\u6A19\u3067\u3059\u3002 75 | gui.vs.lly.label = \u5DE6\u4E0B Y 76 | gui.vs.lly.tooltip = \u30DA\u30FC\u30B8\u4E0A\u306B\u914D\u7F6E\u3059\u308B\u7F72\u540D\u306E\u5DE6\u4E0B\u89D2\u306E Y \u5EA7\u6A19\u3067\u3059\u3002 77 | gui.vs.page.label = \u30DA\u30FC\u30B8 78 | gui.vs.page.tooltip = \u7F72\u540D\u30A4\u30E1\u30FC\u30B8\u3092\u8868\u793A\u3059\u308B\u30DA\u30FC\u30B8\u756A\u53F7\u3067\u3059\u3002 \u6700\u521D\u306E\u30DA\u30FC\u30B8\u306F 1 \u3067\u3059\u3002 79 | gui.vs.position.label = \u4F4D\u7F6E 80 | gui.vs.preview.button = \u4F4D\u7F6E\u306E\u78BA\u8A8D 81 | gui.vs.renderMode.label = \u8868\u793A 82 | gui.vs.settings.label = \u8A2D\u5B9A 83 | gui.vs.title = \u53EF\u8996\u7F72\u540D\u8A2D\u5B9A 84 | gui.vs.urx.label = \u53F3\u4E0A X 85 | gui.vs.urx.tooltip = \u30DA\u30FC\u30B8\u4E0A\u306B\u914D\u7F6E\u3059\u308B\u7F72\u540D\u306E\u53F3\u4E0A\u89D2\u306E X \u5EA7\u6A19\u3067\u3059\u3002 86 | gui.vs.ury.label = \u53F3\u4E0A Y 87 | gui.vs.ury.tooltip = \u30DA\u30FC\u30B8\u4E0A\u306B\u914D\u7F6E\u3059\u308B\u7F72\u540D\u306E\u53F3\u4E0A\u89D2\u306E Y \u5EA7\u6A19\u3067\u3059\u3002 88 | 89 | render.descriptionOnly = \u7F72\u540D\u30C6\u30AD\u30B9\u30C8\u306E\u307F 90 | render.graphicAndDescription = \u30A4\u30E1\u30FC\u30B8\u3068\u7F72\u540D\u30C6\u30AD\u30B9\u30C8 91 | render.signameAndDescription = \u7F72\u540D\u8005\u540D\u3068\u7F72\u540D\u30C6\u30AD\u30B9\u30C8 92 | -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/translations/messages_nb-NO.properties: -------------------------------------------------------------------------------- 1 | console.exception=Et problem oppstod 2 | console.crlinfo.loadCrl=Laster ned CRL fra {0} 3 | console.crlinfo.crlSize=St\u00F8rrelse p\u00E5 nedlastet CRL: {0} 4 | console.crlinfo.alreadyLoaded=Nedlastet CRL finnes allerde. Hopper over \u2026 5 | console.createImage=Oppretter bilde {0} \u2026 6 | console.configureVisible=Setter opp synlig signatur \u2026 7 | gui.vs.position.label=Posisjon 8 | gui.vs.page.tooltip=Sidetallet signaturen vil vises p\u00E5. F\u00F8rste side er nummer 1. 9 | gui.vs.page.label=Side 10 | gui.vs.lly.label=Nede til venstre Y 11 | console.createSignature=Oppretter signatur \u2026 12 | console.creatingTsaClient=Oppretter TSA-klient \u2026 13 | console.createPdfReader=\u00C5pner PDF-inndatafil: {0} 14 | console.createOutPdf=Oppretter PDF-utdatafil: {0} 15 | gui.tsa.policy.label=TSA-praksis (OID) 16 | gui.tsa.ocspServerUrl.label=Forvalgt nettadresse for OCSP-tjener 17 | gui.tsa.ocspEnabled.checkbox=Skru p\u00E5 OCSP 18 | gui.tsa.hashAlg.label=TSA-sjekksummeringsalgoritme 19 | gui.tsa.enabled.checkbox=Bruk tidsstempeltjener 20 | gui.tsa.crlEnabled.checkbox=Skru p\u00E5 CRL 21 | gui.tsa.certFilePwd.label=N\u00F8kkelpassord 22 | serverAuthn.none=Uten identitetsbekreftelse 23 | serverAuthn.password=Brukernavn/passord 24 | hlp.l4Text=statustekst 25 | gui.vs.title=Innstillinger for synlig signatur 26 | gui.vs.settings.label=Innstillinger 27 | gui.vs.l4Text.label=Statustekst 28 | gui.vs.l2TextFontSize.label=Signaturskriftst\u00F8rrelse 29 | gui.vs.l2Text.label=Signaturtekst 30 | gui.vs.bgImgPath.label=Bakgrunnsbilde 31 | gui.visibleSignatureSettings.button=Innstillinger 32 | gui.visibleSignature.checkbox=Synlig signatur 33 | gui.valueNotFilled.error={0} m\u00E5 v\u00E6re utfylt. 34 | gui.tsa.user.label=TSA-bruker 35 | gui.tsa.url.label=TSA-nettadresse 36 | gui.tsa.pwd.label=TSA-passord 37 | gui.tsa.proxyType.label=Type 38 | gui.tsa.proxyHost.label=Mellomtjener-vert/port 39 | gui.tsa.proxy.panel=Mellomtjenerinnstillinger 40 | error.vs.previewFailed=Oida. Forh\u00E5ndsvisning mislyktes. 41 | error.vs.pageNotANumber=Side m\u00E5 v\u00E6re et heltall. 42 | default.l2text.signedBy=Digitalt signert av 43 | default.l2text.reason=Grunn: 44 | console.certificateNotYetValid=Sertifikatet \u00AB{0}\u00BB er ikke gyldig enda. 45 | console.certificateNotForSignature=Sertifikatet \u00AB{0}\u00BB er ikke ment brukt for digital signering. 46 | console.certificateExpired=Sertifikatet \u00AB{0}\u00BB har allerede utl\u00F8pt. 47 | console.certificateChainEmpty=Fant ingen privat n\u00F8kkel. Sjekk n\u00F8kkelkni\u00E5\u00E5e-innstillingene (n\u00F8kkelknippetype, filsti, passord, n\u00F8kkelalias). 48 | certificationLevel.notCertified=Ikke sertifisert 49 | certificationLevel.noChanges=Ingen endringer tillatt 50 | certificationLevel.formFillAnnot=Skjemautfylling og kommentarer tillatt 51 | certificationLevel.formFill=Skjemautfylling tillatt 52 | gui.pdfUserPwd.label=&Brukerpassord 53 | console.keys=N\u00F8kkel-aliaser i n\u00F8kkelknippet: 54 | console.unsupportedEncryptionType=Ust\u00F8ttet krypteringstype. 55 | default.l2text.date=Dato: 56 | gui.advancedView.checkbox=A&vansert visning 57 | gui.loadAliases.button=Last inn &n\u00F8kler 58 | gui.pdfEncryption.label=PDF-kryptering 59 | gui.pdfOwnerPwd.label=&Eier-passord 60 | gui.vs.default.checkbox=Forvalg 61 | gui.vs.imgPath.label=Bilde 62 | console.closeStream=Lukker resulterende PDF-str\u00F8m 63 | console.criticalExtensionNotSupported=Sertifikatet {0} inneholder kritisk utvidelse med OID \u00AB{1}\u00BB som ikke gjenkjennes av JSignPdf. Hopper over. 64 | console.crlinfo.distPointNotSupported=Distribusjonspunkt-utvidelse st\u00F8ttes ikke i angitt sertifikat. 65 | console.crlinfo.foundCrlUri=Fant CRL-nettadresse i distribusjonspunkt: {0} 66 | console.crlinfo.noUrlInDistPoint=Fant ingen HTTP(S)-nettadresse i distribusjonspunkt. 67 | console.fileNotFilled.error=Inn- eller ut-datasti for PDF mangler. 68 | console.filesAreEqual.error=Inn- og ut-datasti for PDF er like. Fyll ut forskjellige stier. 69 | console.crlinfo.retrieveCrlUrl=Leser CRL-distribusjonspunkter fra sertifikat {0} 70 | console.finished.error=Fullf\u00F8rt: Opprettelse av signatur mislyktes. 71 | console.finished.ok=Fullf\u00F8rt: Signatur opprettet. 72 | console.getAliases=Henter n\u00F8kkelalias 73 | console.getCertChain=Henter sertifikatskjede 74 | console.getOCSPURL=Leser OCSP-nettadresse fra sertifikatskjede. 75 | console.getPrivateKey=Leser privat n\u00F8kkel \u2026 76 | console.inFileNotFound.error=Inndata-PDF ble ikke funnet eller er ikke lesbar. 77 | console.getKeystoreType=Henter n\u00F8kkelknippetype-instans: {0} 78 | console.keystores=Tilgjengelige n\u00F8kkelknippetyper: 79 | console.loadKeystore=Laster inn n\u00F8kkelknippe: {0} 80 | console.setReason=Setter grunn: {0} 81 | console.setRender=Setter opptegningsmodus 82 | console.setSignatureGraphic=Setter bilde 83 | console.setVisibleSignature=Oppretter synlig signatur 84 | console.starting=Starter JSignPdf \u2026 85 | gui.browse.button=Utforsk \u2026 86 | gui.certLevel.label=&Sertifiseringsniv\u00E5 87 | gui.check.error.title=Sjekk mislyktes 88 | render.descriptionOnly=Kun beskrivelse 89 | render.graphicAndDescription=Bilde og beskrivelse 90 | serverAuthn.certificate=Klientsertifikat 91 | filefilter.jks=Java-n\u00F8kkelnippefiler (.jks) 92 | filefilter.pdf=PDF-filer (.pdf) 93 | gui.alias.label=N\u00F8kkel&alias 94 | gui.info.close.button=Lukk 95 | gui.keyPassword.label=N\u00F8kkelpass&ord 96 | gui.keystoreFile.label=&N\u00F8kkelknippefil 97 | gui.keystorePassword.label=N\u00F8kkelknippe&passord 98 | gui.keystoreType.label=N\u00F8kkelnippe&type 99 | gui.rights.button=Rettigheter 100 | gui.rights.copy.checkbox=Kopier 101 | gui.rights.fillIn.checkbox=Fyll inn 102 | pdfEncryption.notEncrypted=Ikke kryptert 103 | hlp.visible=Skrur p\u00E5 synlig signatur 104 | pdfEncryption.password=Passord 105 | rights.allowPrinting=Tillat 106 | rights.disallowPrinting=Nekt 107 | render.signameAndDescription=Signaturnavn og beskrivelse 108 | gui.vs.acro6layers.checkbox=Acrobat 6-lagmodus 109 | hlp.version=Viser programversjonen 110 | gui.hashAlgorithm.label=&Sjekksumsalgoritme 111 | gui.info.title=JSignPdf-utdatakonsoll 112 | gui.reason.label=&Grunn (valgfritt) 113 | gui.rights.printing.label=Utskrift 114 | gui.rights.screenReaders.checkbox=Skjermlesere 115 | gui.rights.rights.label=Rights 116 | gui.signIt.button=&Signer 117 | gui.storePasswords.checkbox=&Husk passord 118 | gui.title=JsignPDF (versjon {0}) 119 | gui.vs.browse.button=Utforsk \u2026 120 | gui.vs.close.button=Lukk 121 | -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/translations/messages_pl.properties: -------------------------------------------------------------------------------- 1 | certificationLevel.formFill=Uzupe\u0142nianie p\u00F3l formularza dozwolone 2 | certificationLevel.formFillAnnot=Uzupe\u0142nianie p\u00F3l formularza i komentowanie dozwolone 3 | certificationLevel.noChanges=Bez prawa zmian 4 | certificationLevel.notCertified=Nie certyfikowane 5 | console.closeStream=Zamknij strumie\u0144 PDF 6 | console.configureVisible=Konfiguracja sygnatury wizualnej 7 | console.createImage=Utw\u00F3rz obraz {0} 8 | console.createOutPdf=Utw\u00F3rz plik wyj\u015Bciowy PDF: {0} 9 | console.createPdfReader=Otw\u00F3rz plik wej\u015Bciowy PDF: {0} 10 | console.createSignature=Utw\u00F3rz sygnatur\u0119 11 | console.exception=Wyst\u0105pi\u0142 problem ! 12 | console.finished.error=B\u0142\u0105d: Nie uda\u0142o si\u0119 utworzenie sygnatury 13 | console.finished.ok=Gotowe: Sygnatura utworzona 14 | console.getAliases=Alias klucza 15 | console.getCertChain=\u0141a\u0144cuch certyfikatu 16 | console.getKeystoreType=Typ certyfikatu {0} 17 | console.getPrivateKey=\u0141aduj klucz prywatny: {0} 18 | console.loadKeystore=Plik keystore: {0} 19 | console.memoryError=\r\nJava ma za ma\u0142o pami\u0119ci. Spr\u00F3buj przydieli\u0107 JVM wi\u0119ceej pami\u0119ci.\r\nDo\u0142\u0105cz -Xmx przy wywo\u0142aniu Javy.\r\nn.p.: $java -Xmx512m ... ustawia maksymaln\u0105 pami\u0119\u0107 Java Heap a 512MB.\r\n 20 | console.processing=Przetwarzanie w toku (mo\u017Ce chwil\u0119 potrwa\u0107 . . .) 21 | console.setAcro6Layers=Polece si\u0119 stosowa\u0107 Acrobat 6: {0} 22 | console.setCertificationLevel=Poziom certyfikacji 23 | console.setContact=Kontakt: {0} 24 | console.setEncryption=Zakodowanie 25 | console.setImage=Obraz t\u0142a 26 | console.setImageScale=Skaluj obraz t\u0142a 27 | console.setL2Text=Tekst Poziomu 2 (Opis) 28 | console.setL4Text=Tekst Poziomu 4 (Status) 29 | console.setLocation=Ustaw po\u0142o\u017Cenie {0} 30 | console.setReason=Opis: {0} 31 | console.setRender=Spos\u00F3b renderowania 32 | console.setSignatureGraphic=Ustaw obraz 33 | console.setVisibleSignature=Utw\u00F3rz sygnatur\u0119 wizualn\u0105 34 | console.starting=Rozpocznij sygnowanie PDF 35 | console.usedKeyAlias=Zastosowany klucz: {0} 36 | default.l2text.signedBy=Podpisane cyfrowo przez 37 | filechooser.overwrite.question=Plik {0} istnieje. Czy chcesz go zast\u0105pi\u0107? 38 | filechooser.save.warning=Ostrze\u017Cenie \u2013 Zapis 39 | filefilter.jks=Plik Java keystore (.jks) 40 | filefilter.pdf=Plik PDF (.pdf) 41 | filefilter.pkcs12=Plik PKCS#12 (.pfx, .p12) 42 | gui.advancedView.checkbox=Widok rozszerzony 43 | gui.alias.label=Alias klucza 44 | gui.appendSignature.checkbox=Do\u0142\u0105cz sygnatur\u0119 45 | gui.browse.button=Wybierz 46 | gui.certLevel.label=Poziom certyfikacji 47 | gui.check.error.title=Kontrola zako\u0144czona b\u0142\u0119dem ! 48 | gui.contact.label=Kontakt 49 | gui.fileNotExists.error={0} nie istnieje lub jest nieczytelny 50 | gui.filesEqual.error=B\u0142\u0105d ! Pliki PDF wej\u015Bciowy i wyj\u015Bciowy s\u0105 identyczne ! 51 | gui.inPdfFile.label=Nazwa pliku PDF do sygnowania 52 | gui.info.close.button=Zamknij 53 | gui.info.title=Konsola JsignPdf 54 | gui.keyPassword.label=Has\u0142o Klucz 55 | gui.keystoreFile.label=Plik keystore 56 | gui.keystorePassword.label=Has\u0142o keystore 57 | gui.keystoreType.label=Typ keystore 58 | gui.loadAliases.button=Otw\u00F3rz klucz 59 | gui.location.label=Miejsce 60 | gui.outPdfFile.label=Plik wyj\u015Bciowy PDF 61 | gui.pdfOwnerPwd.label=Has\u0142o w\u0142a\u015Bciciela 62 | gui.pdfUserPwd.label=Has\u0142o u\u017Cytkownika 63 | gui.reason.label=Komentarz 64 | gui.rights.assembly.checkbox=Uprawnienia 65 | gui.rights.button=Przydzia\u0142 uprawnie\u0144 66 | gui.rights.copy.checkbox=Kopiuj 67 | gui.rights.fillIn.checkbox=Wype\u0142nij 68 | gui.rights.modifyAnnotations.checkbox=Zmie\u0144 komentarz 69 | gui.rights.modifyContents.checkbox=Zmiany tre\u015Bci 70 | gui.rights.printing.label=Drukowanie 71 | gui.rights.rights.label=Uprawnienia 72 | gui.rights.screenReaders.checkbox=Screen Reader 73 | gui.rights.title=Uprawnienia 74 | gui.signIt.button=Sygnowanie 75 | gui.storePasswords.checkbox=Zapami\u0119taj has\u0142a 76 | gui.title=JsignPdf (Wersja {0}) 77 | gui.tsa.crlEnabled.checkbox=CRL aktywne 78 | gui.tsa.enabled.checkbox=u\u017Cywaj serwera timestamp 79 | gui.tsa.ocspEnabled.checkbox=OCSP aktywne 80 | gui.tsa.pwd.label=Has\u0142o TSA 81 | gui.tsa.url.label=Url TSA 82 | gui.tsa.user.label=U\u017Cytkownik TSA 83 | gui.valueNotFilled.error={0} musi by\u0107 wype\u0142nione 84 | gui.visibleSignature.checkbox=Sygnatura widoczna 85 | gui.visibleSignatureSettings.button=Ustawienia 86 | gui.vs.bgImgPath.label=Obraz t\u0142a 87 | gui.vs.bgImgScale.label=Skalowanie obrazu t\u0142a 88 | gui.vs.bgImgScale.tooltip=Wprowad\u017A warto\u015B\u0107 dodatni\u0105 skaluj\u0105c\u0105 obraz. \r\n Wprowad\u017A 0 aby obraz t\u0142a wype\u0142ni\u0107.\r\n Wprowad\u017A warto\u015B\u0107 ujemn\u0105 aby zastosowa\u0107 wielko\u015B\u0107 najbardziej pasuj\u0105c\u0105. 89 | gui.vs.browse.button=Szukaj 90 | gui.vs.close.button=Zamknij 91 | gui.vs.default.checkbox=Ustawienia domy\u015Blne 92 | gui.vs.imgPath.label=Obraz 93 | gui.vs.l2Text.label=Tekst sygnatury 94 | gui.vs.l2TextFontSize.label=Wielko\u015B\u0107 czcionki 95 | gui.vs.l4Text.label=Tekst statusu 96 | gui.vs.llx.label=X \u2013 lewy d\u00F3\u0142 97 | gui.vs.llx.tooltip=Warto\u015B\u0107 na osi X \u2013 pozycja sygnatury w lewym dolnym obszarze strony 98 | gui.vs.lly.label=Y \u2013 lewy d\u00F3\u0142 99 | gui.vs.lly.tooltip=Warto\u015B\u0107 na osi Y \u2013 pozycja sygnatury w lewym dolnym obszarze strony 100 | gui.vs.page.label=Strona 101 | gui.vs.page.tooltip=Numer strony na kt\u00F3rej ma by\u0107 umieszczona sygnatura. Pierwsza strona ma numer 1 102 | gui.vs.position.label=Pozycja 103 | gui.vs.renderMode.label=Wizualizacja 104 | gui.vs.settings.label=Ustawienia 105 | gui.vs.title=Ustawienia wizualne sygnatury 106 | gui.vs.urx.label=X \u2013 prawo g\u00F3ra 107 | gui.vs.urx.tooltip=Warto\u015B\u0107 na osi X \u2013 pozycja sygnatury w prawym g\u00F3rnym obszarze strony 108 | gui.vs.ury.label=Y \u2013 prawo g\u00F3ra 109 | gui.vs.ury.tooltip=Warto\u015B\u0107 na osi Y \u2013 pozycja sygnatury w prawym g\u00F3rnym obszarze strony 110 | render.descriptionOnly=Tylko opis 111 | render.graphicAndDescription=Obraz i opis 112 | render.signameAndDescription=Nazwa sygnatury i opis 113 | rights.allowDegradedPrinting=Dopu\u015Bci\u0107 ze zredukowan\u0105 jako\u015Bci\u0105 wydruku 114 | rights.allowPrinting=Dopu\u015Bci\u0107 115 | rights.disallowPrinting=Nie dozwolone 116 | pdfEncryption.certificate=Certyfikat 117 | pdfEncryption.password=Has\u0142a 118 | pdfEncryption.notEncrypted=Nie zaszyfrowane 119 | default.l2text.reason=Pow\u00F3d: 120 | gui.tsa.proxyType.label=Rodzaj 121 | gui.tsa.authn.label=Autoryzacja TSA 122 | gui.preview.title=Podgl\u0105d/Wybierz 123 | gui.tsaOcsp.button=TSA/OCSP/CRL 124 | console.readingCRLs=Odczytywanie CRL 125 | gui.tsa.proxy.panel=Ustawienia proxy 126 | gui.tsa.proxyHost.label=Host/port proxy 127 | default.l2text.date=Data: 128 | default.l2text.location=Lokalizacja: 129 | gui.hashAlgorithm.label=Algorytm &Hash 130 | gui.pdfEncryption.label=Szyfrowanie PDF 131 | -------------------------------------------------------------------------------- /jsignpdf/src/main/resources/net/sf/jsignpdf/translations/messages_ru.properties: -------------------------------------------------------------------------------- 1 | console.setEncryption=\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 \u0448\u0438\u0444\u0440\u043E\u0432\u0430\u043D\u0438\u044F 2 | rights.allowPrinting=\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C 3 | pdfEncryption.password=\u041F\u0430\u0440\u043E\u043B\u0438 4 | pdfEncryption.certificate=\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442 5 | gui.vs.settings.label=\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 6 | gui.vs.position.label=\u041F\u043E\u0437\u0438\u0446\u0438\u044F 7 | gui.vs.page.label=\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 8 | gui.vs.imgPath.label=\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 9 | gui.vs.default.checkbox=\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E 10 | gui.vs.close.button=\u0417\u0430\u043A\u0440\u044B\u0442\u044C 11 | gui.visibleSignatureSettings.button=\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 12 | gui.tsa.proxyType.label=\u0422\u0438\u043F 13 | gui.rights.printing.label=\u041F\u0435\u0447\u0430\u0442\u044C 14 | gui.rights.copy.checkbox=\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C 15 | gui.info.close.button=\u0417\u0430\u043A\u0440\u044B\u0442\u044C 16 | default.l2text.reason=\u041F\u0440\u0438\u0447\u0438\u043D\u0430: 17 | default.l2text.location=\u0420\u0430\u0441\u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435: 18 | default.l2text.date=\u0414\u0430\u0442\u0430: 19 | -------------------------------------------------------------------------------- /jsignpdf/src/test/java/net/sf/jsignpdf/TestConstants.java: -------------------------------------------------------------------------------- 1 | package net.sf.jsignpdf; 2 | 3 | /** 4 | * Constants specific to JUnit tests. 5 | * 6 | * @author Josef Cacek 7 | */ 8 | public class TestConstants { 9 | 10 | public static final String KEYSTORE_JKS = "JKS"; 11 | public static final String KEYSTORE_PKCS12 = "PKCS12"; 12 | public static final String KEYSTORE_BCPKCS12 = "BCPKCS12"; 13 | 14 | public static final char[] KEYSTORE_TEST_PASSWD = "keystorepass".toCharArray(); 15 | public static final String KEYSTORE_FILE_JKS = "src/test/resources/test-keystore.jks"; 16 | public static final String KEYSTORE_FILE_PKCS12 = "src/test/resources/test-keystore.p12"; 17 | 18 | public static final String KEY_PASSWD_SUFFIX = "pass"; 19 | 20 | public static enum Keystore { 21 | JKS(KEYSTORE_FILE_JKS), PKCS12(KEYSTORE_FILE_PKCS12), 22 | // BCPKCS12(KEYSTORE_FILE_PKCS12) 23 | ; 24 | 25 | private final String ksFile; 26 | 27 | private Keystore(final String aFilePath) { 28 | ksFile = aFilePath; 29 | } 30 | 31 | public String getKsFile() { 32 | return ksFile; 33 | } 34 | 35 | public String getKsType() { 36 | return name(); 37 | } 38 | 39 | public char[] getPasswd() { 40 | return KEYSTORE_TEST_PASSWD; 41 | } 42 | } 43 | 44 | /** 45 | * Test private keys present in test keystore file. 46 | * 47 | * @author Josef Cacek 48 | */ 49 | public static enum TestPrivateKey { 50 | EXPIRED(true), RSA1024(false), RSA2048(false), RSA4096(false), DSA1024(false); 51 | 52 | private final boolean expired; 53 | 54 | private TestPrivateKey(boolean anExpired) { 55 | expired = anExpired; 56 | } 57 | 58 | public boolean isExpired() { 59 | return expired; 60 | } 61 | 62 | public String getAlias() { 63 | return name().toLowerCase(); 64 | } 65 | 66 | public char[] getPasswd() { 67 | return (name() + KEY_PASSWD_SUFFIX).toCharArray(); 68 | } 69 | 70 | public BasicSignerOptions toSignerOptions(final Keystore aKeystore) { 71 | final BasicSignerOptions options = new BasicSignerOptions(); 72 | options.setAdvanced(true); 73 | options.setKsType(aKeystore.getKsType()); 74 | options.setKsFile(aKeystore.getKsFile()); 75 | options.setKsPasswd(aKeystore.getPasswd()); 76 | options.setKeyAlias(getAlias()); 77 | options.setKeyPasswd(getPasswd()); 78 | return options; 79 | 80 | } 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /jsignpdf/src/test/java/net/sf/jsignpdf/utils/KeyStoreUtilsTest.java: -------------------------------------------------------------------------------- 1 | package net.sf.jsignpdf.utils; 2 | 3 | import static net.sf.jsignpdf.TestConstants.KEYSTORE_BCPKCS12; 4 | import static net.sf.jsignpdf.TestConstants.KEYSTORE_JKS; 5 | import static net.sf.jsignpdf.TestConstants.KEYSTORE_PKCS12; 6 | import static org.junit.Assert.assertNotNull; 7 | import static org.junit.Assert.assertTrue; 8 | 9 | import java.util.Arrays; 10 | import java.util.List; 11 | import java.util.SortedSet; 12 | 13 | import org.junit.Test; 14 | 15 | import net.sf.jsignpdf.TestConstants; 16 | 17 | /** 18 | * JUnit tests for {@link KeyStoreUtils} class. 19 | * 20 | * @author Josef Cacek 21 | */ 22 | public class KeyStoreUtilsTest { 23 | 24 | /** 25 | * Tests {@link KeyStoreUtils#getKeyStores()}. 26 | */ 27 | @Test 28 | public void testGetKeyStores() { 29 | final SortedSet keyStores = KeyStoreUtils.getKeyStores(); 30 | assertNotNull(keyStores); 31 | // basic types 32 | assertTrue(keyStores.contains(KEYSTORE_JKS)); 33 | assertTrue(keyStores.contains(KEYSTORE_PKCS12)); 34 | // bouncy castle keystore(s) 35 | assertTrue(keyStores.contains(KEYSTORE_BCPKCS12)); 36 | } 37 | 38 | /** 39 | * Tests {@link KeyStoreUtils#getKeyAlias(net.sf.jsignpdf.BasicSignerOptions)} 40 | */ 41 | @Test 42 | public void testGetKeyAliases() { 43 | for (TestConstants.Keystore keystore : TestConstants.Keystore.values()) { 44 | for (TestConstants.TestPrivateKey privateKey : TestConstants.TestPrivateKey.values()) { 45 | System.out.println("Testing " + keystore + ":" + privateKey); 46 | String[] keyAliases = KeyStoreUtils.getKeyAliases(privateKey.toSignerOptions(keystore)); 47 | assertNotNull(keyAliases); 48 | assertTrue(keyAliases.length > 0); 49 | List keyList = Arrays.asList(keyAliases); 50 | assertTrue(keyList.contains(privateKey.getAlias()) != privateKey.isExpired()); 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jsignpdf/src/test/resources/test-keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/test/resources/test-keystore.jks -------------------------------------------------------------------------------- /jsignpdf/src/test/resources/test-keystore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/jsignpdf/src/test/resources/test-keystore.p12 -------------------------------------------------------------------------------- /sample.properties: -------------------------------------------------------------------------------- 1 | keystore.type=WINDOWS-MY 2 | signature.reason=Test reason 3 | signature.location=Brno, Czech republic 4 | 5 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. 4 | 5 | ### Installation 6 | 7 | ``` 8 | $ yarn 9 | ``` 10 | 11 | ### Local Development 12 | 13 | ``` 14 | $ yarn start 15 | ``` 16 | 17 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. 18 | 19 | ### Build 20 | 21 | ``` 22 | $ yarn build 23 | ``` 24 | 25 | This command generates static content into the `build` directory and can be served using any static contents hosting service. 26 | 27 | ### Deployment 28 | 29 | Using SSH: 30 | 31 | ``` 32 | $ USE_SSH=true yarn deploy 33 | ``` 34 | 35 | Not using SSH: 36 | 37 | ``` 38 | $ GIT_USER= yarn deploy 39 | ``` 40 | 41 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. 42 | -------------------------------------------------------------------------------- /website/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /website/blog/2023-08-10-switch-to-docusaurus.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: switch-to-docusaurus 3 | title: Switch to Docusaurus website 4 | authors: kwart 5 | --- 6 | 7 | As SourceForge is sunseting the PHP 5, I've decided to move from the old CMS system to a website generated from the GitHub-stored content. 8 | And the [Docusaurus](https://docusaurus.io/) framework was picked to help me with it. Enjoy! 9 | -------------------------------------------------------------------------------- /website/blog/authors.yml: -------------------------------------------------------------------------------- 1 | kwart: 2 | name: Josef Cacek 3 | title: Author of JSignPdf 4 | url: https://github.com/kwart 5 | image_url: https://github.com/kwart.png 6 | -------------------------------------------------------------------------------- /website/docs/img/advanced-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/advanced-view.png -------------------------------------------------------------------------------- /website/docs/img/cert-level.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/cert-level.png -------------------------------------------------------------------------------- /website/docs/img/hash-algorithm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/hash-algorithm.png -------------------------------------------------------------------------------- /website/docs/img/installcert-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/installcert-tool.png -------------------------------------------------------------------------------- /website/docs/img/jsignpdf-header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/jsignpdf-header.png -------------------------------------------------------------------------------- /website/docs/img/keystore-types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/keystore-types.png -------------------------------------------------------------------------------- /website/docs/img/output-console-window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/output-console-window.png -------------------------------------------------------------------------------- /website/docs/img/preview-select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/preview-select.png -------------------------------------------------------------------------------- /website/docs/img/rights.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/rights.png -------------------------------------------------------------------------------- /website/docs/img/simple-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/simple-view.png -------------------------------------------------------------------------------- /website/docs/img/tsa-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/tsa-settings.png -------------------------------------------------------------------------------- /website/docs/img/visible-dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/docs/img/visible-dialog.png -------------------------------------------------------------------------------- /website/docusaurus.config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Note: type annotations allow type checking and IDEs autocompletion 3 | 4 | const lightCodeTheme = require('prism-react-renderer/themes/github'); 5 | const darkCodeTheme = require('prism-react-renderer/themes/dracula'); 6 | 7 | /** @type {import('@docusaurus/types').Config} */ 8 | const config = { 9 | title: 'JSignPdf', 10 | tagline: 'Sign PDF files for free', 11 | favicon: 'img/signedpdf.png', 12 | 13 | // Set the production url of your site here 14 | url: 'https://intoolswetrust.github.io/', 15 | // Set the // pathname under which your site is served 16 | // For GitHub pages deployment, it is often '//' 17 | baseUrl: '/jsignpdf/', 18 | 19 | // GitHub pages deployment config. 20 | // If you aren't using GitHub pages, you don't need these. 21 | organizationName: 'intoolswetrust', // Usually your GitHub org/user name. 22 | projectName: 'jsignpdf', // Usually your repo name. 23 | 24 | onBrokenLinks: 'throw', 25 | onBrokenMarkdownLinks: 'warn', 26 | 27 | // Even if you don't use internalization, you can use this field to set useful 28 | // metadata like html lang. For example, if your site is Chinese, you may want 29 | // to replace "en" with "zh-Hans". 30 | i18n: { 31 | defaultLocale: 'en', 32 | locales: ['en'], 33 | }, 34 | 35 | presets: [ 36 | [ 37 | 'classic', 38 | /** @type {import('@docusaurus/preset-classic').Options} */ 39 | ({ 40 | docs: { 41 | sidebarPath: require.resolve('./sidebars.js'), 42 | // Please change this to your repo. 43 | // Remove this to remove the "edit this page" links. 44 | // editUrl: 45 | // 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', 46 | }, 47 | blog: { 48 | showReadingTime: true, 49 | // Please change this to your repo. 50 | // Remove this to remove the "edit this page" links. 51 | // editUrl: 52 | // 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', 53 | }, 54 | theme: { 55 | customCss: require.resolve('./src/css/custom.css'), 56 | }, 57 | }), 58 | ], 59 | ], 60 | 61 | themeConfig: 62 | /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ 63 | ({ 64 | // Replace with your project's social card 65 | image: 'img/jsignpdf-social-card.jpg', 66 | navbar: { 67 | title: 'JSignPdf', 68 | logo: { 69 | alt: 'JSignPdf Logo', 70 | src: 'img/signedpdf.png', 71 | }, 72 | items: [ 73 | /** 74 | { 75 | type: 'docSidebar', 76 | sidebarId: 'tutorialSidebar', 77 | position: 'left', 78 | label: 'Tutorial', 79 | }, 80 | */ 81 | {to: '/blog', label: 'Blog', position: 'left'}, 82 | { 83 | href: 'https://github.com/intoolswetrust/jsignpdf', 84 | label: 'GitHub', 85 | position: 'right', 86 | }, 87 | ], 88 | }, 89 | footer: { 90 | style: 'dark', 91 | links: [ 92 | { 93 | title: 'Docs', 94 | items: [ 95 | { 96 | label: 'Guide', 97 | to: '/docs/guide', 98 | }, 99 | ], 100 | }, 101 | { 102 | title: 'Community', 103 | items: [ 104 | { 105 | label: 'Google Group', 106 | href: 'https://groups.google.com/d/forum/jsignpdf', 107 | }, 108 | { 109 | label: 'Stack Overflow', 110 | href: 'https://stackoverflow.com/questions/tagged/jsignpdf', 111 | }, 112 | // { 113 | // label: 'Discord', 114 | // href: 'https://discordapp.com/invite/docusaurus', 115 | // }, 116 | // { 117 | // label: 'Twitter', 118 | // href: 'https://twitter.com/docusaurus', 119 | // }, 120 | ], 121 | }, 122 | { 123 | title: 'More', 124 | items: [ 125 | { 126 | label: 'Blog', 127 | to: '/blog', 128 | }, 129 | { 130 | label: 'GitHub', 131 | href: 'https://github.com/intoolswetrust/jsignpdf', 132 | }, 133 | ], 134 | }, 135 | ], 136 | copyright: `Copyright © ${new Date().getFullYear()} Josef Cacek.`, 137 | }, 138 | prism: { 139 | theme: lightCodeTheme, 140 | darkTheme: darkCodeTheme, 141 | }, 142 | }), 143 | }; 144 | 145 | module.exports = config; 146 | -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "website", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "docusaurus": "docusaurus", 7 | "start": "docusaurus start", 8 | "build": "docusaurus build", 9 | "swizzle": "docusaurus swizzle", 10 | "deploy": "docusaurus deploy", 11 | "clear": "docusaurus clear", 12 | "serve": "docusaurus serve", 13 | "write-translations": "docusaurus write-translations", 14 | "write-heading-ids": "docusaurus write-heading-ids" 15 | }, 16 | "dependencies": { 17 | "@docusaurus/core": "2.4.1", 18 | "@docusaurus/preset-classic": "2.4.1", 19 | "@mdx-js/react": "^1.6.22", 20 | "clsx": "^1.2.1", 21 | "downdoc": "^1.0.2-stable", 22 | "prism-react-renderer": "^1.3.5", 23 | "react": "^17.0.2", 24 | "react-dom": "^17.0.2" 25 | }, 26 | "devDependencies": { 27 | "@docusaurus/module-type-aliases": "2.4.1" 28 | }, 29 | "browserslist": { 30 | "production": [ 31 | ">0.5%", 32 | "not dead", 33 | "not op_mini all" 34 | ], 35 | "development": [ 36 | "last 1 chrome version", 37 | "last 1 firefox version", 38 | "last 1 safari version" 39 | ] 40 | }, 41 | "engines": { 42 | "node": ">=16.14" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /website/sidebars.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Creating a sidebar enables you to: 3 | - create an ordered group of docs 4 | - render a sidebar for each doc of that group 5 | - provide next/previous navigation 6 | 7 | The sidebars can be generated from the filesystem, or explicitly defined here. 8 | 9 | Create as many sidebars as you want. 10 | */ 11 | 12 | // @ts-check 13 | 14 | /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ 15 | const sidebars = { 16 | // By default, Docusaurus generates a sidebar from the docs folder structure 17 | tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], 18 | 19 | // But you can create a sidebar manually 20 | /* 21 | tutorialSidebar: [ 22 | 'intro', 23 | 'hello', 24 | { 25 | type: 'category', 26 | label: 'Tutorial', 27 | items: ['tutorial-basics/create-a-document'], 28 | }, 29 | ], 30 | */ 31 | }; 32 | 33 | module.exports = sidebars; 34 | -------------------------------------------------------------------------------- /website/src/components/HomepageFeatures/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import clsx from 'clsx'; 3 | import styles from './styles.module.css'; 4 | 5 | const FeatureList = [ 6 | { 7 | title: 'Multiplatform', 8 | Svg: require('@site/static/img/java-icon.svg').default, 9 | description: ( 10 | <> 11 | JSignPdf is written in Java and can be run on Windows, Linux, Mac OS and other OS-es where Java is available. 12 | 13 | ), 14 | }, 15 | { 16 | title: 'Document preview', 17 | Svg: require('@site/static/img/preview.svg').default, 18 | description: ( 19 | <> 20 | JSignPdf supports placing visible signatures by selecting area in document preview mode.. 21 | 22 | ), 23 | }, 24 | { 25 | title: 'Batch mode', 26 | Svg: require('@site/static/img/terminal.svg').default, 27 | description: ( 28 | <> 29 | Even if you like more a command-line, JSignPdf is also for you. It can be fully controlled by 30 | command-line arguments, and it can work in a batch mode. 31 | 32 | ), 33 | }, 34 | { 35 | title: 'Timestamps', 36 | Svg: require('@site/static/img/alarm-clock.svg').default, 37 | description: ( 38 | <> 39 | Prove the time of signing. Request a timestamp from your favorite TSA. 40 | 41 | ), 42 | }, 43 | ]; 44 | 45 | function Feature({Svg, title, description}) { 46 | return ( 47 |
48 |
49 | 50 |
51 |
52 |

{title}

53 |

{description}

54 |
55 |
56 | ); 57 | } 58 | 59 | export default function HomepageFeatures() { 60 | return ( 61 |
62 |
63 |
64 | {FeatureList.map((props, idx) => ( 65 | 66 | ))} 67 |
68 |
69 |
70 | ); 71 | } 72 | -------------------------------------------------------------------------------- /website/src/components/HomepageFeatures/styles.module.css: -------------------------------------------------------------------------------- 1 | .features { 2 | display: flex; 3 | align-items: center; 4 | padding: 2rem 0; 5 | width: 100%; 6 | } 7 | 8 | .featureSvg { 9 | height: 200px; 10 | width: 200px; 11 | } 12 | -------------------------------------------------------------------------------- /website/src/css/custom.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Any CSS included here will be global. The classic template 3 | * bundles Infima by default. Infima is a CSS framework designed to 4 | * work well for content-centric websites. 5 | */ 6 | 7 | /* You can override the default Infima variables here. */ 8 | :root { 9 | --ifm-color-primary: #8d3535; 10 | --ifm-color-primary-dark: #7f3030; 11 | --ifm-color-primary-darker: #782d2d; 12 | --ifm-color-primary-darkest: #632525; 13 | --ifm-color-primary-light: #9b3a3a; 14 | --ifm-color-primary-lighter: #a23d3d; 15 | --ifm-color-primary-lightest: #b74545; 16 | --ifm-code-font-size: 95%; 17 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); 18 | } 19 | 20 | /* For readability concerns, you should choose a lighter palette in dark mode. */ 21 | [data-theme='dark'] { 22 | --ifm-color-primary: #4e89e8; 23 | /* 24 | --ifm-color-primary-dark: #21af90; 25 | --ifm-color-primary-darker: #1fa588; 26 | --ifm-color-primary-darkest: #1a8870; 27 | --ifm-color-primary-light: #29d5b0; 28 | --ifm-color-primary-lighter: #32d8b4; 29 | --ifm-color-primary-lightest: #4fddbf; 30 | */ 31 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); 32 | } 33 | -------------------------------------------------------------------------------- /website/src/pages/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import clsx from 'clsx'; 3 | import Link from '@docusaurus/Link'; 4 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 5 | import Layout from '@theme/Layout'; 6 | import HomepageFeatures from '@site/src/components/HomepageFeatures'; 7 | 8 | import styles from './index.module.css'; 9 | 10 | function HomepageHeader() { 11 | const {siteConfig} = useDocusaurusContext(); 12 | return ( 13 |
14 |
15 |

{siteConfig.title}

16 |

{siteConfig.tagline}

17 |
18 | 21 | Download 💾 22 | 23 |
24 |
25 |
26 | ); 27 | } 28 | 29 | export default function Home() { 30 | const {siteConfig} = useDocusaurusContext(); 31 | return ( 32 | 35 | 36 |
37 | 38 |
39 |
40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /website/src/pages/index.module.css: -------------------------------------------------------------------------------- 1 | /** 2 | * CSS files with the .module.css suffix will be treated as CSS modules 3 | * and scoped locally. 4 | */ 5 | 6 | .heroBanner { 7 | padding: 4rem 0; 8 | text-align: center; 9 | position: relative; 10 | overflow: hidden; 11 | } 12 | 13 | @media screen and (max-width: 996px) { 14 | .heroBanner { 15 | padding: 2rem; 16 | } 17 | } 18 | 19 | .buttons { 20 | display: flex; 21 | align-items: center; 22 | justify-content: center; 23 | } 24 | -------------------------------------------------------------------------------- /website/src/pages/markdown-page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Markdown page example 3 | --- 4 | 5 | # Markdown page example 6 | 7 | You don't need React to write simple standalone pages. 8 | -------------------------------------------------------------------------------- /website/static/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/static/.nojekyll -------------------------------------------------------------------------------- /website/static/img/java-icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /website/static/img/jsignpdf-social-card.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/static/img/jsignpdf-social-card.jpg -------------------------------------------------------------------------------- /website/static/img/jsignpdf-social-card.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/static/img/jsignpdf-social-card.xcf -------------------------------------------------------------------------------- /website/static/img/signedpdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intoolswetrust/jsignpdf/660f8facb78c58dd029c2c788aaebeefb1b72c5a/website/static/img/signedpdf.png --------------------------------------------------------------------------------