All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pdftools.crypto.providers.globalsigndss.SignatureConfiguration Maven / Gradle / Ivy

Go to download

The Pdftools SDK is a comprehensive development library that lets developers integrate advanced PDF functionalities into in-house applications.

The newest version!
/****************************************************************************
 *
 * File:            SignatureConfiguration.java
 *
 * Description:     PDFTOOLS SignatureConfiguration Class
 *
 * Author:          PDF Tools AG
 * 
 * Copyright:       Copyright (C) 2023 - 2024 PDF Tools AG, Switzerland
 *                  All rights reserved.
 * 
 * Notice:          By downloading and using this artifact, you accept PDF Tools AG's
 *                  [license agreement](https://www.pdf-tools.com/license-agreement/),
 *                  [privacy policy](https://www.pdf-tools.com/privacy-policy/),
 *                  and allow PDF Tools AG to track your usage data.
 *
 ***************************************************************************/

package com.pdftools.crypto.providers.globalsigndss;

import com.pdftools.sys.*;
import com.pdftools.internal.*;
import java.util.EnumSet;
import java.time.OffsetDateTime;
/**
 * 

The signature configuration

*/ public class SignatureConfiguration extends com.pdftools.sign.SignatureConfiguration { protected SignatureConfiguration(long handle) { super(handle); } /** * @hidden */ public static SignatureConfiguration createDynamicObject(long handle) { return new SignatureConfiguration(handle); } /** *

The message digest algorithm (Getter)

*

* The algorithm used to hash the document and from which the cryptographic signature is created.

*

* Value: {@link com.pdftools.crypto.HashAlgorithm#SHA256 pdftools.crypto.HashAlgorithm.SHA256}. *

*/ public com.pdftools.crypto.HashAlgorithm getHashAlgorithm() { int retVal = getHashAlgorithmNative(getHandle()); if (retVal == 0) { switch (getLastErrorCode()) { case 0: break; default: throwLastRuntimeException(); } } return com.pdftools.crypto.HashAlgorithm.fromValue(retVal); } /** *

The padding type of the cryptographic signature (Getter)

* Value: {@link com.pdftools.crypto.SignaturePaddingType#RSA_RSA pdftools.crypto.SignaturePaddingType.RSA_RSA} */ public com.pdftools.crypto.SignaturePaddingType getSignaturePaddingType() { int retVal = getSignaturePaddingTypeNative(getHandle()); if (retVal == 0) { switch (getLastErrorCode()) { case 0: break; default: throwLastRuntimeException(); } } return com.pdftools.crypto.SignaturePaddingType.fromValue(retVal); } /** *

The format (encoding) of the cryptographic signature (Getter)

* Default: {@link com.pdftools.crypto.SignatureFormat#ETSI_CADES_DETACHED pdftools.crypto.SignatureFormat.ETSI_CADES_DETACHED} */ public com.pdftools.crypto.SignatureFormat getSignatureFormat() { int retVal = getSignatureFormatNative(getHandle()); if (retVal == 0) { switch (getLastErrorCode()) { case 0: break; default: throwLastRuntimeException(); } } return com.pdftools.crypto.SignatureFormat.fromValue(retVal); } /** *

The format (encoding) of the cryptographic signature (Setter)

* Default: {@link com.pdftools.crypto.SignatureFormat#ETSI_CADES_DETACHED pdftools.crypto.SignatureFormat.ETSI_CADES_DETACHED} * @throws IllegalArgumentException if {@code value} is {@code null} */ public void setSignatureFormat(com.pdftools.crypto.SignatureFormat value) { if (value == null) throw new IllegalArgumentException("Argument 'value' must not be null.", new NullPointerException("'value'")); boolean retVal = setSignatureFormatNative(getHandle(), value.getValue()); if (!retVal) { switch (getLastErrorCode()) { case 0: throw new RuntimeException("An unexpected error occurred"); default: throwLastRuntimeException(); } } } /** *

Whether to add a trusted time-stamp to the signature (Getter)

* Default: {@code false} */ public boolean getAddTimestamp() { boolean retVal = getAddTimestampNative(getHandle()); if (!retVal) { switch (getLastErrorCode()) { case 0: break; default: throwLastRuntimeException(); } } return retVal; } /** *

Whether to add a trusted time-stamp to the signature (Setter)

* Default: {@code false} */ public void setAddTimestamp(boolean value) { boolean retVal = setAddTimestampNative(getHandle(), value); if (!retVal) { switch (getLastErrorCode()) { case 0: throw new RuntimeException("An unexpected error occurred"); default: throwLastRuntimeException(); } } } /** *

Whether to add validation information (LTV) (Getter)

*

* Note: This has no effect for signing certificates that do not offer revocation information.

*

* Default: {@link com.pdftools.crypto.ValidationInformation#EMBED_IN_DOCUMENT pdftools.crypto.ValidationInformation.EMBED_IN_DOCUMENT}

*/ public com.pdftools.crypto.ValidationInformation getValidationInformation() { int retVal = getValidationInformationNative(getHandle()); if (retVal == 0) { switch (getLastErrorCode()) { case 0: break; default: throwLastRuntimeException(); } } return com.pdftools.crypto.ValidationInformation.fromValue(retVal); } /** *

Whether to add validation information (LTV) (Setter)

*

* Note: This has no effect for signing certificates that do not offer revocation information.

*

* Default: {@link com.pdftools.crypto.ValidationInformation#EMBED_IN_DOCUMENT pdftools.crypto.ValidationInformation.EMBED_IN_DOCUMENT}

* @throws IllegalArgumentException if {@code value} is {@code null} */ public void setValidationInformation(com.pdftools.crypto.ValidationInformation value) { if (value == null) throw new IllegalArgumentException("Argument 'value' must not be null.", new NullPointerException("'value'")); boolean retVal = setValidationInformationNative(getHandle(), value.getValue()); if (!retVal) { switch (getLastErrorCode()) { case 0: throw new RuntimeException("An unexpected error occurred"); default: throwLastRuntimeException(); } } } private native int getHashAlgorithmNative(long handle); private native int getSignaturePaddingTypeNative(long handle); private native int getSignatureFormatNative(long handle); private native boolean setSignatureFormatNative(long handle, int value); private native boolean getAddTimestampNative(long handle); private native boolean setAddTimestampNative(long handle, boolean value); private native int getValidationInformationNative(long handle); private native boolean setValidationInformationNative(long handle, int value); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy