Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 825d468

Browse files
authored
Refactor GeneXusXmlSignature Module (#81)
issue#97276
1 parent cb41f24 commit 825d468

File tree

8 files changed

+111
-242
lines changed

8 files changed

+111
-242
lines changed

GeneXusXmlSignature/src/main/java/com/genexus/dsig/XmlDSigSigner.java

Lines changed: 93 additions & 224 deletions
Large diffs are not rendered by default.

GeneXusXmlSignature/src/main/java/com/genexus/utils/AsymmetricSigningAlgorithm.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static AsymmetricSigningAlgorithm getAsymmetricSigningAlgorithm(String as
2828
case "ECDSA":
2929
return AsymmetricSigningAlgorithm.ECDSA;
3030
default:
31-
error.setError("AS001", "Unrecognized AsymmetricSigningAlgorithm");
31+
error.setError("ASA01", "Unrecognized AsymmetricSigningAlgorithm");
3232
return null;
3333
}
3434
}
@@ -47,7 +47,7 @@ public static String valueOf(AsymmetricSigningAlgorithm asymmetricSigningAlgorit
4747
case ECDSA:
4848
return "ECDSA";
4949
default:
50-
error.setError("AS002", "Unrecognized AsymmetricSigningAlgorithm");
50+
error.setError("ASA02", "Unrecognized AsymmetricSigningAlgorithm");
5151
return "";
5252
}
5353
}

GeneXusXmlSignature/src/main/java/com/genexus/utils/CanonicalizerWrapper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static CanonicalizerWrapper getCanonicalizerWrapper(String canonicalizerW
3232
case "exc_C14N_WITH_COMMENTS":
3333
return CanonicalizerWrapper.ALGO_ID_C14N_EXCL_WITH_COMMENTS;
3434
default:
35-
error.setError("CM001", "Unrecognized CanonicalizationMethod: " + canonicalizerWrapper);
35+
error.setError("CAW01", "Unrecognized CanonicalizationMethod");
3636
return null;
3737
}
3838
}
@@ -55,7 +55,7 @@ public static String valueOf(CanonicalizerWrapper canonicalizerWrapper, Error er
5555
case ALGO_ID_C14N_EXCL_WITH_COMMENTS:
5656
return "exc_C14N_WITH_COMMENTS";
5757
default:
58-
error.setError("CM002", "Unrecognized CanonicalizationMethod");
58+
error.setError("CAW02", "Unrecognized CanonicalizationMethod");
5959
return "";
6060
}
6161
}
@@ -78,7 +78,7 @@ public static String valueOfInternal(CanonicalizerWrapper canonicalizerWrapper,
7878
case ALGO_ID_C14N_EXCL_WITH_COMMENTS:
7979
return "ALGO_ID_C14N_EXCL_WITH_COMMENTS";
8080
default:
81-
error.setError("CM003", "Unrecognized CanonicalizationMethod");
81+
error.setError("CAW03", "Unrecognized CanonicalizationMethod");
8282
return "";
8383
}
8484
}
@@ -94,7 +94,7 @@ public static String getCanonicalizationMethodAlorithm(CanonicalizerWrapper cano
9494
case ALGO_ID_C14N_EXCL_OMIT_COMMENTS:
9595
return Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS;
9696
default:
97-
error.setError("CM004", "Unrecognized CanonicalizationMethod");
97+
error.setError("CAW04", "Unrecognized CanonicalizationMethod");
9898
return null;
9999

100100
}

GeneXusXmlSignature/src/main/java/com/genexus/utils/KeyInfoType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static KeyInfoType getKeyInfoType(String keyInfoType, Error error) {
1515
case "X509Certificate":
1616
return X509Certificate;
1717
default:
18-
error.setError("KI001", "Unrecognized KeyInfoType");
18+
error.setError("KIT01", "Unrecognized KeyInfoType");
1919
return NONE;
2020
}
2121

@@ -30,7 +30,7 @@ public static String valueOf(KeyInfoType keyInfoType, Error error) {
3030
case X509Certificate:
3131
return "X509Certificate";
3232
default:
33-
error.setError("KI002", "Unrecognized KeyInfoType");
33+
error.setError("KIT02", "Unrecognized KeyInfoType");
3434
return "";
3535
}
3636
}

GeneXusXmlSignature/src/main/java/com/genexus/utils/MessageDigestAlgorithmWrapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static MessageDigestAlgorithmWrapper getMessageDigestAlgorithmWrapper(Str
2828
case "SHA512":
2929
return MessageDigestAlgorithmWrapper.SHA512;
3030
default:
31-
error.setError("MD001", "Algorithm not found: " + messageDigestAlgorithmWrapper);
31+
error.setError("MDA01", "Not recognized digest algorithm");
3232
return null;
3333
}
3434
}
@@ -49,7 +49,7 @@ public static String valueOf(MessageDigestAlgorithmWrapper messageDigestAlgorith
4949
case SHA512:
5050
return "SHA512";
5151
default:
52-
error.setError("MD002", "Not recognized digest algorithm");
52+
error.setError("MDA02", "Not recognized digest algorithm");
5353
return null;
5454
}
5555
}
@@ -63,7 +63,7 @@ public static String getDigestMethod(MessageDigestAlgorithmWrapper messageDigest
6363
case SHA512:
6464
return MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA512;
6565
default:
66-
error.setError("MD003", "Not recognized digest algorithm");
66+
error.setError("MDA03", "Not recognized digest algorithm");
6767
return null;
6868
}
6969
}

GeneXusXmlSignature/src/main/java/com/genexus/utils/SignatureElementType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static String valueOf(SignatureElementType signatureElementType, Error er
1414
case document:
1515
return "document";
1616
default:
17-
error.setError("SE001", "Unrecognized SignatureElementType");
17+
error.setError("SET01", "Unrecognized SignatureElementType");
1818
return "";
1919

2020
}

GeneXusXmlSignature/src/main/java/com/genexus/utils/TransformsWrapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static TransformsWrapper getTransformsWrapper(String transformsWrapper, E
2626
case "DETACHED":
2727
return TransformsWrapper.DETACHED;
2828
default:
29-
error.setError("TW001", "Unrecognized transformation: " + transformsWrapper);
29+
error.setError("TRW01", "Unrecognized transformation");
3030
return null;
3131
}
3232
}
@@ -47,7 +47,7 @@ public static String valueOf(TransformsWrapper transformsWrapper, Error error) {
4747
case DETACHED:
4848
return "DETACHED";
4949
default:
50-
error.setError("TW002", "Unrecognized transformation");
50+
error.setError("TRW02", "Unrecognized transformation");
5151
return null;
5252
}
5353
}
@@ -61,7 +61,7 @@ public static String getSignatureTypeTransform(TransformsWrapper transformsWrapp
6161
case DETACHED:
6262
return "http://www.w3.org/2000/09/xmldsig#detached-signature";
6363
default:
64-
error.setError("TW003", "Unrecognized transformation");
64+
error.setError("TRW03", "Unrecognized transformation");
6565
return null;
6666

6767
}

GeneXusXmlSignature/src/main/java/com/genexus/utils/XMLSignatureWrapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static XMLSignatureWrapper getXMLSignatureWrapper(String xMLSignatureWrap
3030
case "ECDSA_SHA256":
3131
return ECDSA_SHA256;
3232
default:
33-
error.setError("XS001", "Unrecognized algorithm: " + xMLSignatureWrapper);
33+
error.setError("XSW01", "Unrecognized algorithm");
3434
return null;
3535
}
3636
}
@@ -55,7 +55,7 @@ public static String valueOf(XMLSignatureWrapper xMLSignatureWrapper, Error erro
5555
case ECDSA_SHA256:
5656
return "ECDSA_SHA256";
5757
default:
58-
error.setError("XS002", "Unrecognized algorithm");
58+
error.setError("XSW02", "Unrecognized algorithm");
5959
return null;
6060
}
6161
}
@@ -73,7 +73,7 @@ public static String getSignatureMethodAlgorithm(XMLSignatureWrapper xMLSignatur
7373
case ECDSA_SHA256:
7474
return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA256;
7575
default:
76-
error.setError("XS003", "Unrecognized algorithm");
76+
error.setError("XSW03", "Unrecognized algorithm");
7777
return null;
7878
}
7979
}

0 commit comments

Comments
 (0)