Skip to content

Commit

Permalink
Release 1.1.0 (#3)
Browse files Browse the repository at this point in the history
* Update project to latest tag client-hsm-1.1.0

* Update pom.xml

* Update pom.xml

* Update pom.xml

* Update compile.yml

* Update release.yml

* Update pom.xml

* Update SNAPSHOT version

* [maven-release-plugin] prepare release client-hsm-1.1.0

* [maven-release-plugin] prepare for next development iteration

---------

Co-authored-by: parerworker <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent bd868b0 commit 44fac10
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ jobs:
compile:
uses: RegioneER/parer-github-template/.github/workflows/compile.yml@v1
with:
java: '8'
java: '11'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
uses: RegioneER/parer-github-template/.github/workflows/release.yml@v1
with:
version: ${{ inputs.version }}
java: '8'
java: '11'
72 changes: 44 additions & 28 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@
<modelVersion>4.0.0</modelVersion>
<groupId>it.eng.parer</groupId>
<artifactId>client-hsm</artifactId>
<version>1.0.3-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Client HSM</name>
<description>Modulo per effettuare firma e validazione di documenti firmati interagendo col sistema HSM.</description>

<parent>
<groupId>it.eng.parer</groupId>
<artifactId>parer-pom</artifactId>
<version>4.2.0</version>
<version>6.4.1</version>
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<distributionManagement>
<repository>
Expand All @@ -29,7 +25,11 @@
<id>github</id>
<url>https://maven.pkg.github.com/RegioneER/parer-framework-parerpom</url>
</repository>
</repositories>
</repositories>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
Expand Down Expand Up @@ -62,45 +62,61 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.10</version>
</dependency>

<!--JDK 11 -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>${jaxws-api.version}</version>
</dependency>
<!-- JAXB -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.version}</version>
</dependency>
<!-- JAXWS -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-jakartaee-8.0</artifactId>
<type>pom</type>
<version>${jboss-jakartaee-8.0.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- Esclusione dai javadoc delle classi generate da jaxb -->
<excludePackageNames>it.eng.hsm.prod.*:it.eng.hsm.test.*</excludePackageNames>
</configuration>
</plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- Esclusione dai javadoc delle classi generate da jaxb -->
<excludePackageNames>it.eng.hsm.prod.*:it.eng.hsm.test.*</excludePackageNames>
</configuration>
</plugin>
</plugins>

</build>

<scm>
<scm>
<developerConnection>scm:git:https://github.com/RegioneER/parer-integrazione-hsm.git</developerConnection>
<tag>HEAD</tag>
</scm>

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- Esclusione dai javadoc delle classi generate da jaxb -->
<excludePackageNames>it.eng.hsm.prod.*:it.eng.hsm.test.*</excludePackageNames>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- Esclusione dai javadoc delle classi generate da jaxb -->
<excludePackageNames>it.eng.hsm.prod.*:it.eng.hsm.test.*</excludePackageNames>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
8 changes: 6 additions & 2 deletions src/main/java/it/eng/hsm/ClientHSM.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public byte[] signP7M(HSMSignatureSession session, byte[] fileToSign)
* the user who requires the signature
* @param fileToSign
* file to sign
* @param marcaTemporale
* marca temporale si/no
*
* @return array di byte del documento XADES firmato
*
Expand All @@ -134,7 +136,7 @@ public byte[] signP7M(HSMSignatureSession session, byte[] fileToSign)
* @throws HSMException
* if a generic error occurs
*/
public byte[] signXAdES(HSMUser user, byte[] fileToSign)
public byte[] signXAdES(HSMUser user, byte[] fileToSign, boolean marcaTemporale)
throws AuthenticationException, OTPException, UserBlockedException, HSMException;

/**
Expand Down Expand Up @@ -168,6 +170,8 @@ public byte[] signXAdES(HSMUser user, byte[] fileToSign, ConfigurationXAdES conf
* the signature session has to be previously opened
* @param fileToSign
* file to sign
* @param marcaTemporale
* marca temporale si/no
*
* @return array di byte del documento XADES firmato
*
Expand All @@ -180,7 +184,7 @@ public byte[] signXAdES(HSMUser user, byte[] fileToSign, ConfigurationXAdES conf
* @throws HSMException
* if a generic error occurs
*/
public byte[] signXAdES(HSMSignatureSession session, byte[] fileToSign)
public byte[] signXAdES(HSMSignatureSession session, byte[] fileToSign, boolean marcaTemporale)
throws AuthenticationException, OTPException, UserBlockedException, HSMException;

/**
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/it/eng/hsm/ClientHSM_Prod.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ private byte[] signsP7M(RemoteSignatureCredentials credentials, byte[] fileToSig

// <editor-fold defaultstate="collapsed" desc="XAdES functions">
private static ConfigurationXAdES getDefaultConfigurationXAdES() {
return new ConfigurationXAdES(XAdES.PROFILES.BES, XAdES.TYPE.DETACHED, XAdES.VALIDATION.T);
// return new ConfigurationXAdES(XAdES.PROFILES.BES, XAdES.TYPE.DETACHED, XAdES.VALIDATION.T);
return new ConfigurationXAdES(XAdES.PROFILES.BES, null, null);
}

private static ConfigurationXAdES getConfigurationXAdESWithTimestamp() {
return new ConfigurationXAdES(XAdES.PROFILES.BES, null, XAdES.VALIDATION.T);
}

@Override
Expand All @@ -208,15 +213,16 @@ public boolean isXAdESActive() {
}

@Override
public byte[] signXAdES(HSMUser user, byte[] fileToSign) throws HSMException {
public byte[] signXAdES(HSMUser user, byte[] fileToSign, boolean marcaTemporale) throws HSMException {

byte[] result = null;

if (user == null || fileToSign == null) {
throw new IllegalArgumentException();
}

result = signsXAdES(getRemoteSignatureCredentials(user), fileToSign, getDefaultConfigurationXAdES());
result = signsXAdES(getRemoteSignatureCredentials(user), fileToSign,
marcaTemporale ? getConfigurationXAdESWithTimestamp() : getDefaultConfigurationXAdES());
return result;
}

Expand All @@ -233,15 +239,16 @@ public byte[] signXAdES(HSMUser user, byte[] fileToSign, ConfigurationXAdES conf
}

@Override
public byte[] signXAdES(HSMSignatureSession session, byte[] fileToSign) throws HSMException {
public byte[] signXAdES(HSMSignatureSession session, byte[] fileToSign, boolean marcaTemporale)
throws HSMException {
byte[] result = null;

if (session == null || fileToSign == null) {
throw new IllegalArgumentException();
}

result = signsXAdES(getRemoteSignatureCredentials(session.getUser()), fileToSign,
getDefaultConfigurationXAdES());
marcaTemporale ? getConfigurationXAdESWithTimestamp() : getDefaultConfigurationXAdES());
return result;
}

Expand Down Expand Up @@ -276,6 +283,7 @@ private byte[] signsXAdES(RemoteSignatureCredentials credentials, byte[] fileToS
}

try {
logger.info("Validazione XADES richiesta: {}", params.getValidationData());
signedBytes = client.signXAdES(credentials, fileToSign, Constants.DIGEST_TYPE, null, params);
logger.debug("Test HSM - " + credentials.getUserid() + " signed a XAdES file");
} catch (RemoteSignatureExceptionException er) {
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/it/eng/hsm/ClientHSM_Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ private byte[] signsP7M(RemoteSignatureCredentials credentials, byte[] fileToSig

// <editor-fold defaultstate="collapsed" desc="XAdES functions">
private static ConfigurationXAdES getDefaultConfigurationXAdES() {
return new ConfigurationXAdES(XAdES.PROFILES.BES, XAdES.TYPE.DETACHED, XAdES.VALIDATION.T);
// return new ConfigurationXAdES(XAdES.PROFILES.BES, XAdES.TYPE.DETACHED, XAdES.VALIDATION.T);
return new ConfigurationXAdES(XAdES.PROFILES.BES, null, null);
}

private static ConfigurationXAdES getConfigurationXAdESWithTimestamp() {
return new ConfigurationXAdES(XAdES.PROFILES.BES, null, XAdES.VALIDATION.T);
}

@Override
Expand All @@ -207,15 +212,16 @@ public boolean isXAdESActive() {
}

@Override
public byte[] signXAdES(HSMUser user, byte[] fileToSign) throws HSMException {
public byte[] signXAdES(HSMUser user, byte[] fileToSign, boolean marcaTemporale) throws HSMException {

byte[] result = null;

if (user == null || fileToSign == null) {
throw new IllegalArgumentException();
}

result = signsXAdES(getRemoteSignatureCredentials(user), fileToSign, getDefaultConfigurationXAdES());
result = signsXAdES(getRemoteSignatureCredentials(user), fileToSign,
marcaTemporale ? getConfigurationXAdESWithTimestamp() : getDefaultConfigurationXAdES());
return result;
}

Expand All @@ -232,15 +238,16 @@ public byte[] signXAdES(HSMUser user, byte[] fileToSign, ConfigurationXAdES conf
}

@Override
public byte[] signXAdES(HSMSignatureSession session, byte[] fileToSign) throws HSMException {
public byte[] signXAdES(HSMSignatureSession session, byte[] fileToSign, boolean marcaTemporale)
throws HSMException {
byte[] result = null;

if (session == null || fileToSign == null) {
throw new IllegalArgumentException();
}

result = signsXAdES(getRemoteSignatureCredentials(session.getUser()), fileToSign,
getDefaultConfigurationXAdES());
marcaTemporale ? getConfigurationXAdESWithTimestamp() : getDefaultConfigurationXAdES());
return result;
}

Expand Down Expand Up @@ -275,6 +282,7 @@ private byte[] signsXAdES(RemoteSignatureCredentials credentials, byte[] fileToS
}

try {
logger.info("Validazione XADES richiesta: {}", params.getValidationData());
signedBytes = client.signXAdES(credentials, fileToSign, Constants.DIGEST_TYPE, null, params);
logger.debug("Test HSM - " + credentials.getUserid() + " signed a XAdES file");
} catch (RemoteSignatureExceptionException er) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class RemoteSignatureXadesParams {
protected String signatureId;
@XmlElement(required = true, nillable = true)
protected String type;
@XmlElement(required = true, nillable = true)
@XmlElement(required = true, nillable = false)
protected String validationData;

/**
Expand Down

0 comments on commit 44fac10

Please sign in to comment.