├── signerx-common
├── src
│ └── main
│ │ ├── resources
│ │ ├── gelecex_config.properties
│ │ ├── log4j.properties
│ │ ├── errors_en.properties
│ │ └── errors_tr.properties
│ │ └── java
│ │ └── com
│ │ └── gelecex
│ │ └── signerx
│ │ └── common
│ │ ├── EnumHashAlgorithm.java
│ │ ├── EnumSignatureType.java
│ │ ├── signature
│ │ └── BaseSigner.java
│ │ ├── smartcard
│ │ ├── SmartcardAtr.java
│ │ ├── SmartcardConfig.java
│ │ ├── SmartcardLibrary.java
│ │ ├── SmartcardType.java
│ │ ├── SignerxSmartcard.java
│ │ └── SignerxCertificate.java
│ │ ├── exception
│ │ └── SignerxException.java
│ │ └── SignerxLocalization.java
└── pom.xml
├── signerx-webservice
├── src
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── com
│ │ └── gelecex
│ │ └── signerx
│ │ ├── SignerxApplication.java
│ │ └── controller
│ │ └── SignerxRestController.java
└── pom.xml
├── signerx-cades
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── gelecex
│ │ └── signerx
│ │ └── cades
│ │ ├── CadesSignerx.java
│ │ └── CadesSignerxImpl.java
└── pom.xml
├── signerx-xades
└── pom.xml
├── signerx-verification
└── pom.xml
├── signerx-utils
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── gelecex
│ │ │ └── signerx
│ │ │ └── utils
│ │ │ ├── SignerxUtils.java
│ │ │ └── SCXmlParser.java
│ └── resources
│ │ └── scdatabase.xml
│ └── test
│ ├── java
│ └── com
│ │ └── gelecex
│ │ └── signerx
│ │ └── utils
│ │ └── SCXmlParserTest.java
│ └── resources
│ └── scdatabase.xml
├── README.md
├── signerx-pades
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── gelecex
│ └── signerx
│ └── pades
│ ├── dto
│ └── PadesSignature.java
│ └── PadesSigner.java
├── pom.xml
├── .gitignore
└── LICENSE
/signerx-common/src/main/resources/gelecex_config.properties:
--------------------------------------------------------------------------------
1 | gelecex.lang=en
--------------------------------------------------------------------------------
/signerx-webservice/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 9063
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/EnumHashAlgorithm.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common;
2 |
3 | /**
4 | * Created by obetron on 27.04.2022
5 | */
6 | public enum EnumHashAlgorithm {
7 |
8 | SHA256, SHA512;
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/signerx-common/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootLogger=DEBUG, STDOUT
2 | log4j.logger.deng=INFO
3 | log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
4 | log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
5 | log4j.appender.STDOUT.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/EnumSignatureType.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common;
2 |
3 | /**
4 | * @author obetron
5 | * created on 21.04.2022
6 | */
7 |
8 | public enum EnumSignatureType {
9 | BES, EPES, T, C, X_Type1, X_Type2, X, XL_Type1, XL_Type2, XL, A
10 | }
11 |
--------------------------------------------------------------------------------
/signerx-common/src/main/resources/errors_en.properties:
--------------------------------------------------------------------------------
1 | smartcardReaderError=Error occured while smartcard config file reading.
2 | documentBuilderError=Some configuration requests are missing1, documentBuilder cannot be created!
3 | documentSAXError=Parsing error occurred!
4 | documentIOError=Error occurred while reading configuration file!
--------------------------------------------------------------------------------
/signerx-common/src/main/resources/errors_tr.properties:
--------------------------------------------------------------------------------
1 | smartcardReaderError=Akıllı kart konfigurasyon dosyası okunurken hata oluştu.
2 | documentBuilderError=Bazı konfigürasyon isterleri eksik, documentBuilder nesnesi oluşturulamadı!
3 | documentSAXError=XML dosyası ayrıştırılırken hata oluştu!
4 | documentIOError=Konfigürasyon dosyası okunurken hata oluştu!
--------------------------------------------------------------------------------
/signerx-cades/src/main/java/com/gelecex/signerx/cades/CadesSignerx.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.cades;
2 |
3 | import com.gelecex.signerx.common.EnumSignatureType;
4 |
5 | /**
6 | * Created by obetron on 21.04.2022
7 | */
8 |
9 | public interface CadesSignerx {
10 |
11 | byte[] sign(byte[] dataToBeSigned, EnumSignatureType signatureType);
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/signature/BaseSigner.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common.signature;
2 |
3 | import com.gelecex.signerx.common.exception.SignerxException;
4 |
5 | /**
6 | * Created by obetron on 6.06.2022
7 | */
8 | public interface BaseSigner {
9 |
10 | byte[] createSignature(byte[] dataToBeSigned) throws SignerxException;
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/smartcard/SmartcardAtr.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common.smartcard;
2 |
3 | /**
4 | * Created by obetron on 26.04.2022
5 | */
6 | public class SmartcardAtr {
7 | private String value;
8 | public String getValue() {
9 | return value;
10 | }
11 | public void setValue(String value) {
12 | this.value = value;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/signerx-cades/src/main/java/com/gelecex/signerx/cades/CadesSignerxImpl.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.cades;
2 |
3 | import com.gelecex.signerx.common.EnumSignatureType;
4 |
5 | /**
6 | * Created by obetron on 21.04.2022
7 | */
8 |
9 | public class CadesSignerxImpl implements CadesSignerx {
10 | @Override
11 | public byte[] sign(byte[] dataToBeSigned, EnumSignatureType signatureType) {
12 | return new byte[0];
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/signerx-xades/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | signerx-xades
5 | 0.0.1
6 |
7 | 4.0.0
8 |
9 | com.gelecex.signerx
10 | signerx
11 | 0.0.5
12 | ../pom.xml
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/signerx-common/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | signerx-common
5 | 0.0.5
6 |
7 | 4.0.0
8 |
9 | com.gelecex.signerx
10 | signerx
11 | 0.0.5
12 | ../pom.xml
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/signerx-verification/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | signerx-verification
5 | 0.0.1
6 |
7 | 4.0.0
8 |
9 | com.gelecex.signerx
10 | signerx
11 | 0.0.5
12 | ../pom.xml
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/signerx-webservice/src/main/java/com/gelecex/signerx/SignerxApplication.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author obetron
8 | * @date 11.02.2023 - 22:27
9 | */
10 | @SpringBootApplication
11 | public class SignerxApplication {
12 | public static void main( String[] args ) {
13 | SpringApplication.run(SignerxApplication.class, args);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/smartcard/SmartcardConfig.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common.smartcard;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by obetron on 26.04.2022
7 | */
8 | public class SmartcardConfig {
9 |
10 | private List cardTypeList;
11 |
12 | public List getCardTypeList() {
13 | return cardTypeList;
14 | }
15 |
16 | public void setCardTypeList(List cardTypeList) {
17 | this.cardTypeList = cardTypeList;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/signerx-webservice/src/main/java/com/gelecex/signerx/controller/SignerxRestController.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | /**
8 | * @author obetron
9 | * @date 11.02.2023 - 22:27
10 | */
11 | @RestController
12 | @RequestMapping("signerx")
13 | public class SignerxRestController {
14 |
15 | @GetMapping("/version")
16 | public String getVersion() {
17 | return "v0.0.2";
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/smartcard/SmartcardLibrary.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common.smartcard;
2 |
3 | /**
4 | * Created by obetron on 26.04.2022
5 | */
6 | public class SmartcardLibrary {
7 |
8 | private String name;
9 | private String arch;
10 |
11 | public String getName() {
12 | return name;
13 | }
14 |
15 | public void setName(String name) {
16 | this.name = name;
17 | }
18 |
19 | public String getArch() {
20 | return arch;
21 | }
22 |
23 | public void setArch(String arch) {
24 | this.arch = arch;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/signerx-webservice/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.gelecex.signerx
6 | signerx
7 | 0.0.5
8 | ../pom.xml
9 |
10 | signerx-webservice
11 |
12 | signerx-webservice
13 | 0.0.1
14 |
15 |
--------------------------------------------------------------------------------
/signerx-cades/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | signerx-cades
5 | 0.0.1
6 |
7 | 4.0.0
8 |
9 | com.gelecex.signerx
10 | signerx
11 | 0.0.5
12 | ../pom.xml
13 |
14 |
15 |
16 |
17 | com.gelecex.signerx
18 | signerx-common
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/exception/SignerxException.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common.exception;
2 |
3 | /**
4 | * Created by obetron on 25.04.2022
5 | */
6 | public class SignerxException extends Exception {
7 | public SignerxException() {
8 | super();
9 | }
10 |
11 | public SignerxException(String message) {
12 | super(message);
13 | }
14 |
15 | public SignerxException(String message, Throwable cause) {
16 | super(message, cause);
17 | }
18 |
19 | public SignerxException(Throwable cause) {
20 | super(cause);
21 | }
22 |
23 | protected SignerxException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
24 | super(message, cause, enableSuppression, writableStackTrace);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/signerx-utils/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | signerx-utils
5 | 0.0.5
6 |
7 | 4.0.0
8 |
9 | com.gelecex.signerx
10 | signerx
11 | 0.0.5
12 | ../pom.xml
13 |
14 |
15 |
16 |
17 | com.gelecex.signerx
18 | signerx-common
19 | 0.0.1
20 |
21 |
22 | sax
23 | sax
24 | 2.0.1
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # signerx
2 | gelecex-signer projesi birden fazla modulden olusan vefarkli modullerin imzalamada farkli islemleri ustlendigi bir projedir.
3 |
4 | * signerx-smartcard
5 | * signerx-cades
6 | * signerx-xades
7 | * signerx-pades
8 | * signerx-verification
9 |
10 | ## signerx-smartcard
11 | signerx-smartcard modulu, akilli karta baglanatarak icerisindeki slotlardan sertifikalari ceke kodlari icermektedir.
12 |
13 | ## signerx-cades
14 | signerx-cades modulu, cades ES_BES'ten baslayarak, ES_A tipine kadar imza atabilen kodlari icermektedir.
15 |
16 | ## signerx-pades
17 | signerx-pades modulu, pades BES'ten LTV tipine kadar imza atabilen kodlari icermektedir.
18 |
19 | ## signerx-xades
20 | signerx-xades modulu, xades ES_BES'ten ES_A tipine kadar imza atabilen kodlari icermektedir.
21 |
22 | ## signerx-verification
23 | signerx-verfication modulu, imzanin dogrulama sonuclarini hesaplayan kodlari icermektedir.
--------------------------------------------------------------------------------
/signerx-pades/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | signerx-pades
5 | 0.0.1
6 |
7 | 4.0.0
8 |
9 | com.gelecex.signerx
10 | signerx
11 | 0.0.5
12 | ../pom.xml
13 |
14 |
15 |
16 | com.gelecex.signerx
17 | signerx-common
18 |
19 |
20 | com.gelecex.signerx
21 | signerx-utils
22 |
23 |
24 | org.apache.pdfbox
25 | pdfbox
26 |
27 |
28 |
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/smartcard/SmartcardType.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common.smartcard;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by obetron on 26.04.2022
7 | */
8 | public class SmartcardType {
9 |
10 | private String name;
11 | private List libraryList;
12 | private List atrList;
13 |
14 | public String getName() {
15 | return name;
16 | }
17 |
18 | public void setName(String name) {
19 | this.name = name;
20 | }
21 |
22 | public List getLibraryList() {
23 | return libraryList;
24 | }
25 |
26 | public void setLibraryList(List libraryList) {
27 | this.libraryList = libraryList;
28 | }
29 |
30 | public List getAtrList() {
31 | return atrList;
32 | }
33 |
34 | public void setAtrList(List atrList) {
35 | this.atrList = atrList;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/smartcard/SignerxSmartcard.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common.smartcard;
2 |
3 | import java.security.cert.X509Certificate;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by obetron on 1.05.2022
8 | */
9 | public class SignerxSmartcard {
10 |
11 | private String cardName;
12 | private String cardLibName;
13 | private List certificateInfos;
14 | private List certificateList;
15 |
16 | public String getCardName() {
17 | return cardName;
18 | }
19 |
20 | public void setCardName(String cardName) {
21 | this.cardName = cardName;
22 | }
23 |
24 | public String getCardLibName() {
25 | return cardLibName;
26 | }
27 |
28 | public void setCardLibName(String cardLibName) {
29 | this.cardLibName = cardLibName;
30 | }
31 |
32 | public List getCertificateInfos() {
33 | return certificateInfos;
34 | }
35 |
36 | public void setCertificateInfos(List certificateInfos) {
37 | this.certificateInfos = certificateInfos;
38 | }
39 |
40 | public List getCertificateList() {
41 | return certificateList;
42 | }
43 |
44 | public void setCertificateList(List certificateList) {
45 | this.certificateList = certificateList;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/smartcard/SignerxCertificate.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common.smartcard;
2 |
3 | import java.util.Date;
4 |
5 | /**
6 | * Created by obetron on 1.05.2022
7 | */
8 | public class SignerxCertificate {
9 |
10 | private String serialNumber;
11 | private String commonName;
12 | private String issuerName;
13 | private String tckno;
14 | private Date notBefore;
15 | private Date notAfter;
16 |
17 | public String getSerialNumber() {
18 | return serialNumber;
19 | }
20 |
21 | public void setSerialNumber(String serialNumber) {
22 | this.serialNumber = serialNumber;
23 | }
24 |
25 | public String getCommonName() {
26 | return commonName;
27 | }
28 |
29 | public void setCommonName(String commonName) {
30 | this.commonName = commonName;
31 | }
32 |
33 | public String getIssuerName() {
34 | return issuerName;
35 | }
36 |
37 | public void setIssuerName(String issuerName) {
38 | this.issuerName = issuerName;
39 | }
40 |
41 | public String getTckno() {
42 | return tckno;
43 | }
44 |
45 | public void setTckno(String tckno) {
46 | this.tckno = tckno;
47 | }
48 |
49 | public Date getNotBefore() {
50 | return notBefore;
51 | }
52 |
53 | public void setNotBefore(Date notBefore) {
54 | this.notBefore = notBefore;
55 | }
56 |
57 | public Date getNotAfter() {
58 | return notAfter;
59 | }
60 |
61 | public void setNotAfter(Date notAfter) {
62 | this.notAfter = notAfter;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/signerx-common/src/main/java/com/gelecex/signerx/common/SignerxLocalization.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.common;
2 |
3 | import java.io.FileNotFoundException;
4 | import java.io.IOException;
5 | import java.util.Locale;
6 | import java.util.Properties;
7 | import java.util.ResourceBundle;
8 |
9 | /**
10 | * Created by obetron on 22.12.2018
11 | */
12 | public class SignerxLocalization {
13 |
14 | private static ResourceBundle resourceBundle;
15 | private static String message;
16 |
17 | public static String getErrorMessage(String str) {
18 | return getMessage(str, "errors");
19 | }
20 |
21 | public static String getWarningMessage(String str) {
22 | return getMessage(str, "warning");
23 | }
24 |
25 | public static String getInfoMessage(String str) {
26 | return getMessage(str, "info");
27 | }
28 |
29 | private static String getMessage(String msg, String type) {
30 | resourceBundle = ResourceBundle.getBundle(type,
31 | new Locale(readGelecexConfigFile("gelecex.lang")));
32 | message = resourceBundle.getString(msg);
33 | return message;
34 | }
35 |
36 | private static String readGelecexConfigFile(String key) {
37 | try {
38 | Properties properties = new Properties();
39 | properties.load(SignerxLocalization.class.getResourceAsStream("/gelecex_config.properties"));
40 | return properties.getProperty(key);
41 | } catch (FileNotFoundException e) {
42 | e.printStackTrace();
43 | } catch (IOException e) {
44 | e.printStackTrace();
45 | }
46 | return null;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/signerx-pades/src/main/java/com/gelecex/signerx/pades/dto/PadesSignature.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.pades.dto;
2 |
3 | /**
4 | * Created by obetron on 7.06.2022
5 | */
6 | public class PadesSignature {
7 |
8 | private String name;
9 | private String location;
10 | private String reason;
11 | private String contanctInfo;
12 | private String signatureDate;
13 | private byte[] content;
14 | private byte[] signedContent;
15 |
16 | public String getName() {
17 | return name;
18 | }
19 |
20 | public void setName(String name) {
21 | this.name = name;
22 | }
23 |
24 | public String getLocation() {
25 | return location;
26 | }
27 |
28 | public void setLocation(String location) {
29 | this.location = location;
30 | }
31 |
32 | public String getReason() {
33 | return reason;
34 | }
35 |
36 | public void setReason(String reason) {
37 | this.reason = reason;
38 | }
39 |
40 | public String getContanctInfo() {
41 | return contanctInfo;
42 | }
43 |
44 | public void setContanctInfo(String contanctInfo) {
45 | this.contanctInfo = contanctInfo;
46 | }
47 |
48 | public String getSignatureDate() {
49 | return signatureDate;
50 | }
51 |
52 | public void setSignatureDate(String signatureDate) {
53 | this.signatureDate = signatureDate;
54 | }
55 |
56 | public byte[] getContent() {
57 | return content;
58 | }
59 |
60 | public void setContent(byte[] content) {
61 | this.content = content;
62 | }
63 |
64 | public byte[] getSignedContent() {
65 | return signedContent;
66 | }
67 |
68 | public void setSignedContent(byte[] signedContent) {
69 | this.signedContent = signedContent;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/signerx-utils/src/main/java/com/gelecex/signerx/utils/SignerxUtils.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.utils;
2 |
3 | import com.gelecex.signerx.common.EnumHashAlgorithm;
4 | import com.gelecex.signerx.common.exception.SignerxException;
5 |
6 | import java.security.MessageDigest;
7 | import java.security.NoSuchAlgorithmException;
8 |
9 | /**
10 | * Created by obetron on 27.04.2022
11 | */
12 | public class SignerxUtils {
13 |
14 | public static byte[] calculateHash(byte[] val, String digestAlg) throws SignerxException {
15 | if(digestAlg.equals("SHA256") || digestAlg.equals("SHA-256")) {
16 | return calculateHash(val, EnumHashAlgorithm.SHA256);
17 | } else if(digestAlg.equals("SHA512") || digestAlg.equals("SHA-512")) {
18 | return calculateHash(val, EnumHashAlgorithm.SHA512);
19 | } else {
20 | throw new SignerxException("Desteklenmeyen Ozet Algoritması Hatası!!!");
21 | }
22 | }
23 |
24 | public static byte[] calculateHash(byte[] val, EnumHashAlgorithm gelecexDigestAlg) throws SignerxException {
25 | try {
26 | MessageDigest messageDigest = MessageDigest.getInstance(gelecexDigestAlg.toString());
27 | return messageDigest.digest(val);
28 | } catch (NoSuchAlgorithmException e) {
29 | throw new SignerxException("Hatali mesaj ozeti!", e);
30 | }
31 | }
32 |
33 | public static String byteToHex(byte[] bytes) {
34 | StringBuilder sb = new StringBuilder(bytes.length * 2);
35 | for (int i = 0; i < bytes.length; i++) {
36 | int v = bytes[i] & 0xff;
37 | if (v < 16) {
38 | sb.append('0');
39 | }
40 | sb.append(Integer.toHexString(v));
41 | }
42 | return sb.toString().toUpperCase();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/signerx-pades/src/main/java/com/gelecex/signerx/pades/PadesSigner.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.pades;
2 |
3 | import com.gelecex.signerx.common.exception.SignerxException;
4 | import com.gelecex.signerx.common.signature.BaseSigner;
5 | import com.gelecex.signerx.pades.dto.PadesSignature;
6 | import org.apache.pdfbox.Loader;
7 | import org.apache.pdfbox.pdmodel.PDDocument;
8 | import org.apache.pdfbox.pdmodel.interactive.digitalsignature.ExternalSigningSupport;
9 | import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature;
10 |
11 | import java.io.ByteArrayOutputStream;
12 | import java.io.IOException;
13 |
14 | /**
15 | * Created by obetron on 6.06.2022
16 | */
17 | public class PadesSigner implements BaseSigner {
18 |
19 | private PadesSignature padesSignature;
20 |
21 | private PadesSigner(){}
22 |
23 | public PadesSigner(PadesSignature padesSignature) {
24 | this.padesSignature = padesSignature;
25 | }
26 |
27 | @Override
28 | public byte[] createSignature(byte[] dataToBeSigned) throws SignerxException {
29 | return createPdfSignature(dataToBeSigned);
30 |
31 |
32 | //TODO: 1. check the type of byte array is really pdf?
33 | //TODO: 2. sign byte array pdf in pades format.
34 | }
35 |
36 | private byte[] createPdfSignature(byte[] originalPdf) throws SignerxException {
37 | try (PDDocument pdDocument = Loader.loadPDF(originalPdf)){
38 | PDSignature pdSignature = createPDSignature();
39 | pdDocument.addSignature(pdSignature);
40 |
41 | ByteArrayOutputStream out = new ByteArrayOutputStream();
42 | ExternalSigningSupport exSignSupp = pdDocument.saveIncrementalForExternalSigning(out);
43 |
44 | return new byte[0];
45 | } catch (IOException e) {
46 | throw new SignerxException("Error occured during load the pdf", e);
47 | }
48 | }
49 |
50 | private PDSignature createPDSignature() {
51 | PDSignature pdSignature = new PDSignature();
52 | pdSignature.setFilter(PDSignature.FILTER_ADOBE_PPKLITE);
53 | pdSignature.setSubFilter(PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED);
54 | pdSignature.setName(padesSignature.getName());
55 | pdSignature.setLocation(padesSignature.getLocation());
56 | pdSignature.setReason(padesSignature.getReason());
57 | return pdSignature;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/signerx-utils/src/test/java/com/gelecex/signerx/utils/SCXmlParserTest.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.utils;
2 |
3 | import com.gelecex.signerx.common.exception.SignerxException;
4 | import com.gelecex.signerx.common.smartcard.SmartcardAtr;
5 | import com.gelecex.signerx.common.smartcard.SmartcardLibrary;
6 | import com.gelecex.signerx.common.smartcard.SmartcardType;
7 | import org.junit.jupiter.api.Assertions;
8 | import org.junit.jupiter.api.BeforeEach;
9 | import org.junit.jupiter.api.Test;
10 |
11 | import org.xml.sax.SAXException;
12 |
13 | import javax.xml.parsers.ParserConfigurationException;
14 | import java.io.IOException;
15 | import java.util.List;
16 |
17 | /**
18 | * Created by obetron on 24.04.2022
19 | */
20 | public class SCXmlParserTest {
21 |
22 | private SCXmlParser scDatabase;
23 | private List smartcardTypeList;
24 |
25 | @BeforeEach
26 | public void init() throws SignerxException {
27 | scDatabase = new SCXmlParser();
28 | smartcardTypeList = scDatabase.readSmarcardDatabaseXml();
29 | }
30 |
31 | @Test
32 | public void testGetSmartcardDetailListNotNull() throws SignerxException, ParserConfigurationException, IOException, SAXException {
33 | Assertions.assertNotNull(smartcardTypeList);
34 | }
35 |
36 | @Test
37 | public void testSmartcardTypeName() throws ParserConfigurationException, IOException, SAXException {
38 | SmartcardType smartcardType = smartcardTypeList.get(0);
39 | String smartcardName = smartcardType.getName();
40 | Assertions.assertEquals("AEPKEYPER", smartcardName);
41 | }
42 |
43 | @Test
44 | public void testSmartcardLibName() {
45 | SmartcardType smartcardType = smartcardTypeList.get(0);
46 | List libraryList = smartcardType.getLibraryList();
47 | SmartcardLibrary smartcardLibrary = libraryList.get(0);
48 | Assertions.assertEquals("bp201w32HSM", smartcardLibrary.getName());
49 | }
50 |
51 | @Test
52 | public void testSmartcardLibArchVal() {
53 | SmartcardType smartcardType = smartcardTypeList.get(4);
54 | List libraryList = smartcardType.getLibraryList();
55 | SmartcardLibrary smartcardLibrary = libraryList.get(0);
56 | Assertions.assertEquals("32", smartcardLibrary.getArch());
57 | }
58 |
59 | @Test
60 | public void testSmartcardAtrVal() {
61 | SmartcardType smartcardType = smartcardTypeList.get(1);
62 | List atrList = smartcardType.getAtrList();
63 | SmartcardAtr smartcardAtr = atrList.get(0);
64 | Assertions.assertEquals("3BBA11008131FE4D55454B41452056312E30AE", smartcardAtr.getValue());
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 | 4.0.0
7 |
8 |
9 | org.springframework.boot
10 | spring-boot-starter-parent
11 | 3.2.0
12 |
13 |
14 |
15 | com.gelecex.signerx
16 | signerx
17 | ${signerx.version}
18 | pom
19 |
20 |
21 | signerx-common
22 | signerx-utils
23 | signerx-cades
24 | signerx-pades
25 | signerx-xades
26 | signerx-verification
27 | signerx-pkcs11
28 | signerx-webservice
29 |
30 |
31 |
32 | UTF-8
33 | 8
34 | 8
35 | 0.0.5
36 | 5.9.2
37 | 1.6.6
38 | 3.7.2
39 | 2.17.2
40 |
41 |
42 |
43 |
44 |
45 | com.gelecex.signerx
46 | signerx-common
47 | ${signerx.version}
48 |
49 |
50 | com.gelecex.signerx
51 | signerx-utils
52 | 0.0.5
53 |
54 |
55 | org.apache.pdfbox
56 | pdfbox
57 | 3.0.0-RC1
58 |
59 |
60 |
61 |
62 | org.junit.jupiter
63 | junit-jupiter-api
64 | ${junit.version}
65 | test
66 |
67 |
68 |
69 |
70 | org.apache.logging.log4j
71 | log4j-api
72 | ${log4j.version}
73 |
74 |
75 |
76 | org.springframework.boot
77 | spring-boot-starter
78 |
79 |
80 | org.springframework.boot
81 | spring-boot-starter-web
82 |
83 |
84 | org.springframework.boot
85 | spring-boot-starter-test
86 | test
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/signerx-utils/src/main/java/com/gelecex/signerx/utils/SCXmlParser.java:
--------------------------------------------------------------------------------
1 | package com.gelecex.signerx.utils;
2 |
3 | import com.gelecex.signerx.common.exception.SignerxException;
4 | import com.gelecex.signerx.common.smartcard.SmartcardAtr;
5 | import com.gelecex.signerx.common.smartcard.SmartcardLibrary;
6 | import com.gelecex.signerx.common.smartcard.SmartcardType;
7 | import org.xml.sax.Attributes;
8 | import org.xml.sax.SAXException;
9 | import org.xml.sax.helpers.DefaultHandler;
10 |
11 | import javax.xml.parsers.ParserConfigurationException;
12 | import javax.xml.parsers.SAXParser;
13 | import javax.xml.parsers.SAXParserFactory;
14 | import java.io.IOException;
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | /**
19 | * Created by obetron on 24.04.2022
20 | */
21 | public class SCXmlParser extends DefaultHandler {
22 |
23 | private SmartcardType smartcardType;
24 | private List smartcardTypeList;
25 | private List smartcardLibrayList;
26 | private List smartcardAtrList;
27 |
28 | public List readSmarcardDatabaseXml() throws SignerxException {
29 | String scdatabasePath = "/scdatabase.xml";
30 | try {
31 | SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
32 | SAXParser saxParser = saxParserFactory.newSAXParser();
33 | saxParser.parse(getClass().getResourceAsStream(scdatabasePath), this);
34 | return smartcardTypeList;
35 | } catch (SAXException e) {
36 | throw new SignerxException("SAX parser hatasi olustu!", e);
37 | } catch (ParserConfigurationException e) {
38 | throw new SignerxException("SAX parse olusturulamadi!", e);
39 | } catch (IllegalArgumentException e) {
40 | throw new SignerxException(scdatabasePath + " dosyasi, verilen path icerisinde bulunamadi!", e);
41 | } catch (IOException e) {
42 | throw new SignerxException("I/O hatasi olustu!", e);
43 | }
44 | }
45 |
46 | @Override
47 | public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
48 | if("smartcard-config".equalsIgnoreCase(qName)) {
49 | smartcardTypeList = new ArrayList<>();
50 | }
51 | if(qName.equalsIgnoreCase("card-type")) {
52 | smartcardType = new SmartcardType();
53 | if(attributes != null && attributes.getLength() > 0) {
54 | smartcardType.setName(attributes.getValue("name"));
55 | }
56 | smartcardLibrayList = new ArrayList<>();
57 | smartcardAtrList = new ArrayList<>();
58 | }
59 | if(qName.equalsIgnoreCase("lib")) {
60 | SmartcardLibrary smartcardLibrary = new SmartcardLibrary();
61 | if(attributes.getLength() > 0) {
62 | if(attributes.getValue("name") != null) {
63 | smartcardLibrary.setName(attributes.getValue("name"));
64 | }
65 | if (attributes.getValue("arch") != null) {
66 | smartcardLibrary.setArch(attributes.getValue("arch"));
67 | }
68 | }
69 | smartcardLibrayList.add(smartcardLibrary);
70 | }
71 | if(qName.equalsIgnoreCase("atr")) {
72 | smartcardType.setLibraryList(smartcardLibrayList);
73 | SmartcardAtr smartcardAtr = new SmartcardAtr();
74 | if(attributes != null && attributes.getLength() > 0 && attributes.getValue("value") != null) {
75 | smartcardAtr.setValue(attributes.getValue("value"));
76 | }
77 | smartcardAtrList.add(smartcardAtr);
78 | }
79 | }
80 |
81 | @Override
82 | public void endElement(String uri, String localName, String qName) throws SAXException {
83 | if("card-type".equalsIgnoreCase(qName)) {
84 | smartcardType.setAtrList(smartcardAtrList);
85 | smartcardType.setLibraryList(smartcardLibrayList);
86 | smartcardTypeList.add(smartcardType);
87 | smartcardType = new SmartcardType();
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/signerx-utils/src/main/resources/scdatabase.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/signerx-utils/src/test/resources/scdatabase.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### MicrosoftOffice template
3 | *.tmp
4 |
5 | # Word temporary
6 | ~$*.doc*
7 |
8 | # Excel temporary
9 | ~$*.xls*
10 |
11 | # Excel Backup File
12 | *.xlk
13 |
14 | # PowerPoint temporary
15 | ~$*.ppt*
16 |
17 | # Visio autosave temporary files
18 | *.~vsd*
19 | ### Windows template
20 | # Windows thumbnail cache files
21 | Thumbs.db
22 | ehthumbs.db
23 | ehthumbs_vista.db
24 |
25 | # Dump file
26 | *.stackdump
27 |
28 | # Folder config file
29 | [Dd]esktop.ini
30 |
31 | # Recycle Bin used on file shares
32 | $RECYCLE.BIN/
33 |
34 | # Windows Installer files
35 | *.cab
36 | *.msi
37 | *.msix
38 | *.msm
39 | *.msp
40 |
41 | # Windows shortcuts
42 | *.lnk
43 | ### Redis template
44 | # Ignore redis binary dump (dump.rdb) files
45 |
46 | *.rdb
47 | ### JDeveloper template
48 | # default application storage directory used by the IDE Performance Cache feature
49 | .data/
50 |
51 | # used for ADF styles caching
52 | temp/
53 |
54 | # default output directories
55 | classes/
56 | deploy/
57 | javadoc/
58 |
59 | # lock file, a part of Oracle Credential Store Framework
60 | cwallet.sso.lck### Linux template
61 | *~
62 |
63 | # temporary files which can be created if a process still has a handle open of a deleted file
64 | .fuse_hidden*
65 |
66 | # KDE directory preferences
67 | .directory
68 |
69 | # Linux trash folder which might appear on any partition or disk
70 | .Trash-*
71 |
72 | # .nfs files are created when an open file is removed but is still being accessed
73 | .nfs*
74 | ### Java template
75 | # Compiled class file
76 | *.class
77 |
78 | # Log file
79 | *.log
80 |
81 | # BlueJ files
82 | *.ctxt
83 |
84 | # Mobile Tools for Java (J2ME)
85 | .mtj.tmp/
86 |
87 | # Package Files #
88 | *.war
89 | *.nar
90 | *.ear
91 | *.zip
92 | *.tar.gz
93 | *.rar
94 |
95 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
96 | hs_err_pid*
97 | ### SVN template
98 | .svn/
99 | ### Gradle template
100 | .gradle
101 | /build/
102 |
103 | # Ignore Gradle GUI config
104 | gradle-app.setting
105 |
106 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
107 | !gradle-wrapper.jar
108 |
109 | # Cache of project
110 | .gradletasknamecache
111 |
112 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
113 | # gradle/wrapper/gradle-wrapper.properties
114 | ### Dropbox template
115 | # Dropbox settings and caches
116 | .dropbox
117 | .dropbox.attr
118 | .dropbox.cache
119 | ### NetBeans template
120 | nbproject/private/
121 | build/
122 | nbbuild/
123 | dist/
124 | nbdist/
125 | .nb-gradle/
126 | ### Android template
127 | # Built application files
128 | *.apk
129 | *.ap_
130 |
131 | # Files for the ART/Dalvik VM
132 | *.dex
133 |
134 | # Java class files
135 |
136 | # Generated files
137 | bin/
138 | gen/
139 | out/
140 |
141 | # Gradle files
142 | .gradle/
143 |
144 | # Local configuration file (sdk path, etc)
145 | local.properties
146 |
147 | # Proguard folder generated by Eclipse
148 | proguard/
149 |
150 | # Log Files
151 |
152 | # Android Studio Navigation editor temp files
153 | .navigation/
154 |
155 | # Android Studio captures folder
156 | captures/
157 |
158 | # IntelliJ
159 | *.iml
160 | .idea/workspace.xml
161 | .idea/tasks.xml
162 | .idea/gradle.xml
163 | .idea/assetWizardSettings.xml
164 | .idea/dictionaries
165 | .idea/libraries
166 | .idea/caches
167 | .idea/compiler.xml
168 | .idea/kotlinc.xml
169 | .idea/modules.xml
170 |
171 | # Keystore files
172 | # Uncomment the following line if you do not want to check your keystore files in.
173 | #*.jks
174 |
175 | # External native build folder generated in Android Studio 2.2 and later
176 | .externalNativeBuild
177 |
178 | # Google Services (e.g. APIs or Firebase)
179 | google-services.json
180 |
181 | # Freeline
182 | freeline.py
183 | freeline/
184 | freeline_project_description.json
185 |
186 | # fastlane
187 | fastlane/report.xml
188 | fastlane/Preview.html
189 | fastlane/screenshots
190 | fastlane/test_output
191 | fastlane/readme.md
192 | ### Kotlin template
193 | # Compiled class file
194 |
195 | # Log file
196 |
197 | # BlueJ files
198 |
199 | # Mobile Tools for Java (J2ME)
200 |
201 | # Package Files #
202 |
203 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
204 | ### Eclipse template
205 |
206 | .metadata
207 | tmp/
208 | *.bak
209 | *.swp
210 | *~.nib
211 | .settings/
212 | .loadpath
213 | .recommenders
214 |
215 | # External tool builders
216 | .externalToolBuilders/
217 |
218 | # Locally stored "Eclipse launch configurations"
219 | *.launch
220 |
221 | # PyDev specific (Python IDE for Eclipse)
222 | *.pydevproject
223 |
224 | # CDT-specific (C/C++ Development Tooling)
225 | .cproject
226 |
227 | # CDT- autotools
228 | .autotools
229 |
230 | # Java annotation processor (APT)
231 | .factorypath
232 |
233 | # PDT-specific (PHP Development Tools)
234 | .buildpath
235 |
236 | # sbteclipse plugin
237 | .target
238 |
239 | # Tern plugin
240 | .tern-project
241 |
242 | # TeXlipse plugin
243 | .texlipse
244 |
245 | # STS (Spring Tool Suite)
246 | .springBeans
247 |
248 | # Code Recommenders
249 | .recommenders/
250 |
251 | # Annotation Processing
252 | .apt_generated/
253 |
254 | # Scala IDE specific (Scala & Java development for Eclipse)
255 | .cache-main
256 | .scala_dependencies
257 | .worksheet
258 | ### Vim template
259 | # Swap
260 | [._]*.s[a-v][a-z]
261 | [._]*.sw[a-p]
262 | [._]s[a-rt-v][a-z]
263 | [._]ss[a-gi-z]
264 | [._]sw[a-p]
265 |
266 | # Session
267 | Session.vim
268 |
269 | # Temporary
270 | .netrwhist
271 | # Auto-generated tag files
272 | tags
273 | # Persistent undo
274 | [._]*.un~
275 | ### PlayFramework template
276 | # Ignore Play! working directory #
277 | /db
278 | .eclipse
279 | /logs/
280 | /modules
281 | /project/project
282 | /project/target
283 | /target
284 | test-result
285 | server.pid
286 | *.eml
287 | /dist/
288 | .cache
289 | ### Maven template
290 | target/
291 | pom.xml.tag
292 | pom.xml.releaseBackup
293 | pom.xml.versionsBackup
294 | pom.xml.next
295 | release.properties
296 | dependency-reduced-pom.xml
297 | buildNumber.properties
298 | .mvn/timing.properties
299 | .mvn/wrapper/maven-wrapper.jar
300 | ### macOS template
301 | # General
302 | .DS_Store
303 | .AppleDouble
304 | .LSOverride
305 |
306 | # Icon must end with two \r
307 | Icon
308 |
309 | # Thumbnails
310 | ._*
311 |
312 | # Files that might appear in the root of a volume
313 | .DocumentRevisions-V100
314 | .fseventsd
315 | .Spotlight-V100
316 | .TemporaryItems
317 | .Trashes
318 | .VolumeIcon.icns
319 | .com.apple.timemachine.donotpresent
320 |
321 | # Directories potentially created on remote AFP share
322 | .AppleDB
323 | .AppleDesktop
324 | Network Trash Folder
325 | Temporary Items
326 | .apdisk
327 | ### NotepadPP template
328 | # Notepad++ backups #
329 | ### SublimeText template
330 | # Cache files for Sublime Text
331 | *.tmlanguage.cache
332 | *.tmPreferences.cache
333 | *.stTheme.cache
334 |
335 | # Workspace files are user-specific
336 | *.sublime-workspace
337 |
338 | # Project files should be checked into the repository, unless a significant
339 | # proportion of contributors will probably not be using Sublime Text
340 | # *.sublime-project
341 |
342 | # SFTP configuration file
343 | sftp-config.json
344 |
345 | # Package control specific files
346 | Package Control.last-run
347 | Package Control.ca-list
348 | Package Control.ca-bundle
349 | Package Control.system-ca-bundle
350 | Package Control.cache/
351 | Package Control.ca-certs/
352 | Package Control.merged-ca-bundle
353 | Package Control.user-ca-bundle
354 | oscrypto-ca-bundle.crt
355 | bh_unicode_properties.cache
356 |
357 | # Sublime-github package stores a github token in this file
358 | # https://packagecontrol.io/packages/sublime-github
359 | GitHub.sublime-settings
360 | ### TortoiseGit template
361 | # Project-level settings
362 | /.tgitconfig
363 | ### JetBrains template
364 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
365 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
366 |
367 | # User-specific stuff
368 | .idea/**/workspace.xml
369 | .idea/**/tasks.xml
370 | .idea/**/usage.statistics.xml
371 | .idea/**/dictionaries
372 | .idea/**/shelf
373 |
374 | # Sensitive or high-churn files
375 | .idea/**/dataSources/
376 | .idea/**/dataSources.ids
377 | .idea/**/dataSources.local.xml
378 | .idea/**/sqlDataSources.xml
379 | .idea/**/dynamic.xml
380 | .idea/**/uiDesigner.xml
381 | .idea/**/dbnavigator.xml
382 |
383 | # Gradle
384 | .idea/**/gradle.xml
385 | .idea/**/libraries
386 |
387 | # Gradle and Maven with auto-import
388 | # When using Gradle or Maven with auto-import, you should exclude module files,
389 | # since they will be recreated, and may cause churn. Uncomment if using
390 | # auto-import.
391 | # .idea/modules.xml
392 | # .idea/*.iml
393 | # .idea/modules
394 |
395 | # CMake
396 | cmake-build-*/
397 |
398 | # Mongo Explorer plugin
399 | .idea/**/mongoSettings.xml
400 |
401 | # File-based project format
402 | *.iws
403 |
404 | # IntelliJ
405 |
406 | # mpeltonen/sbt-idea plugin
407 | .idea_modules/
408 |
409 | # JIRA plugin
410 | atlassian-ide-plugin.xml
411 |
412 | # Cursive Clojure plugin
413 | .idea/replstate.xml
414 |
415 | # Crashlytics plugin (for Android Studio and IntelliJ)
416 | com_crashlytics_export_strings.xml
417 | crashlytics.properties
418 | crashlytics-build.properties
419 | fabric.properties
420 |
421 | # Editor-based Rest Client
422 | .idea/httpRequests
423 | ### LibreOffice template
424 | # LibreOffice locks
425 | .~lock.*#
426 | ### GWT template
427 |
428 | # Package Files #
429 |
430 | # gwt caches and compiled units #
431 | war/gwt_bree/
432 | gwt-unitCache/
433 |
434 | # boilerplate generated classes #
435 |
436 | # more caches and things from deploy #
437 | war/WEB-INF/deploy/
438 | war/WEB-INF/classes/
439 |
440 | #compilation logs
441 | .gwt/
442 |
443 | #gwt junit compilation files
444 | www-test/
445 |
446 | #old GWT (1.5) created this dir
447 | .gwt-tmp/
448 | /.idea/workspace.xml
449 | /.idea/misc.xml
450 | /.idea/vcs.xml
451 | .idea/*
452 | /.vscode
453 | .vscode/*
454 | src/main/java/com/gelecex/smartcard/GelecexSmartcard.java
455 | src/main/java/com/gelecex/smartcard/controller/SmartcardController.java
456 | src/main/java/com/gelecex/smartcard/enums/GelecexDigestAlg.java
457 | src/main/java/com/gelecex/smartcard/exception/GelecexSignerException.java
458 | src/main/java/com/gelecex/smartcard/exception/SmartcardReaderException.java
459 | src/main/java/com/gelecex/smartcard/exception/XMLParserException.java
460 | src/main/java/com/gelecex/smartcard/model/Smartcard.java
461 | src/main/java/com/gelecex/smartcard/model/SmartcardLibrary.java
462 | src/main/java/com/gelecex/smartcard/parser/XMLParser.java
463 | src/main/java/com/gelecex/smartcard/parser/XMLParserImpl.java
464 | src/main/java/com/gelecex/smartcard/service/SmartcardDao.java
465 | src/main/java/com/gelecex/smartcard/service/SmartcardService.java
466 | src/main/java/com/gelecex/smartcard/service/SmartcardServiceImpl.java
467 | src/main/java/com/gelecex/smartcard/service/SmartcardXMLImpl.java
468 | src/main/java/com/gelecex/smartcard/utils/ConfigurationUploader.java
469 | src/main/java/com/gelecex/smartcard/utils/GelecexI18n.java
470 | src/main/java/com/gelecex/smartcard/utils/GelecexUtils.java
471 | src/test/java/com/gelecex/smartcard/model/SmartcardDAOTest.java
472 | src/test/java/com/gelecex/smartcard/parser/XmlConfigFileParserTest.java
473 | src/test/java/com/gelecex/smartcard/service/SmartcardServiceTest.java
474 | src/test/java/com/gelecex/smartcard/utils/ConfigurationUploaderTest.java
475 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------