Skip to content
This repository was archived by the owner on May 26, 2020. It is now read-only.

Commit 36ed2db

Browse files
committed
SANTUARIO-533 - Renamed ENCRYPT (verb) -> ENCRYPTION (noun) to align with SIGNATURE (noun). Thanks to Peter De Maeyer for the patch. This closes #22.
git-svn-id: https://svn.apache.org/repos/asf/santuario/xml-security-java/trunk@1876585 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5e84949 commit 36ed2db

11 files changed

Lines changed: 75 additions & 61 deletions

File tree

src/main/java/org/apache/xml/security/stax/ext/OutboundXMLSec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private XMLStreamWriter processOutMessage(
139139
signEntireRequestPart = securePart;
140140
}
141141
}
142-
} else if (XMLSecurityConstants.ENCRYPT.equals(action)) {
142+
} else if (XMLSecurityConstants.ENCRYPTION.equals(action)) {
143143
XMLEncryptOutputProcessor encryptOutputProcessor = new XMLEncryptOutputProcessor();
144144
initializeOutputProcessor(outputProcessorChain, encryptOutputProcessor, action);
145145

src/main/java/org/apache/xml/security/stax/ext/XMLSec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public static XMLSecurityProperties validateAndApplyDefaultsToOutboundSecurityPr
165165
if (securityProperties.getSignatureKeyIdentifiers().isEmpty()) {
166166
securityProperties.setSignatureKeyIdentifier(SecurityTokenConstants.KeyIdentifier_IssuerSerial);
167167
}
168-
} else if (XMLSecurityConstants.ENCRYPT.equals(action)) {
168+
} else if (XMLSecurityConstants.ENCRYPTION.equals(action)) {
169169
if (securityProperties.getEncryptionKeyTransportAlgorithm() == null) {
170170
//@see http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5 :
171171
//"RSA-OAEP is RECOMMENDED for the transport of AES keys"

src/main/java/org/apache/xml/security/stax/ext/XMLSecurityConstants.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,12 @@ public enum DIRECTION {
261261
public static final String ENCRYPTION_PARTS = "encryptionParts";
262262

263263
public static final Action SIGNATURE = new Action("Signature");
264-
public static final Action ENCRYPT = new Action("Encrypt");
264+
public static final Action ENCRYPTION = new Action("Encryption");
265+
/**
266+
* Use {@link #ENCRYPTION} instead.
267+
*/
268+
@Deprecated
269+
public static final Action ENCRYPT = ENCRYPTION;
265270

266271
public static final QName TAG_dsigmore_RSAPSSPARAMS = new QName(NS_DSIG_MORE_2007_05, "RSAPSSParams", PREFIX_DSIG_MORE_PSS);
267272
public static final QName TAG_dsigmore_SALTLENGTH = new QName(NS_DSIG_MORE_2007_05, "SaltLength", PREFIX_DSIG_MORE_PSS);

src/main/java/org/apache/xml/security/stax/impl/processor/input/XMLSecurityInputProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public XMLSecurityInputProcessor(XMLSecurityProperties securityProperties) {
5454
// If no actions are set (default behaviour) we do signature and decryption processing
5555
// If the only action is XMLSecurityConstants.ENCRYPT then we only do decryption and skip signature processing
5656
decryptOnly = securityProperties.getActions().size() == 1 &&
57-
securityProperties.getActions().contains(XMLSecurityConstants.ENCRYPT);
57+
securityProperties.getActions().contains(XMLSecurityConstants.ENCRYPTION);
5858
}
5959

6060
@Override

src/test/java/org/apache/xml/security/test/stax/encryption/DecryptionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ public void testDecryptElementValidationInDecryptOnlyMode() throws Exception {
18451845
// Decrypt
18461846
XMLSecurityProperties properties = new XMLSecurityProperties();
18471847
properties.setDecryptionKey(secretKey);
1848-
properties.addAction(XMLSecurityConstants.ENCRYPT);
1848+
properties.addAction(XMLSecurityConstants.ENCRYPTION);
18491849
InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
18501850
TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
18511851
XMLStreamReader securityStreamReader =
@@ -1906,7 +1906,7 @@ public void testDecryptContentValidationInDecryptOnlyMode() throws Exception {
19061906
// Decrypt
19071907
XMLSecurityProperties properties = new XMLSecurityProperties();
19081908
properties.setDecryptionKey(secretKey);
1909-
properties.addAction(XMLSecurityConstants.ENCRYPT);
1909+
properties.addAction(XMLSecurityConstants.ENCRYPTION);
19101910
InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
19111911
TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
19121912
XMLStreamReader securityStreamReader =
@@ -1964,7 +1964,7 @@ public void testDecryptWholeDocumentInDecryptOnlyMode() throws Exception {
19641964
// Decrypt
19651965
XMLSecurityProperties properties = new XMLSecurityProperties();
19661966
properties.setDecryptionKey(secretKey);
1967-
properties.addAction(XMLSecurityConstants.ENCRYPT);
1967+
properties.addAction(XMLSecurityConstants.ENCRYPTION);
19681968
InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
19691969
TestSecurityEventListener securityEventListener = new TestSecurityEventListener();
19701970
XMLStreamReader securityStreamReader =

src/test/java/org/apache/xml/security/test/stax/encryption/EncryptionCreationTest.java

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void testEncryptionContentCreation() throws Exception {
9191
// Set up the Configuration
9292
XMLSecurityProperties properties = new XMLSecurityProperties();
9393
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
94-
actions.add(XMLSecurityConstants.ENCRYPT);
94+
actions.add(XMLSecurityConstants.ENCRYPTION);
9595
properties.setActions(actions);
9696

9797
// Set the key up
@@ -149,7 +149,7 @@ public void testEncryptRootElementInRequest() throws Exception {
149149
// Set up the Configuration
150150
XMLSecurityProperties properties = new XMLSecurityProperties();
151151
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
152-
actions.add(XMLSecurityConstants.ENCRYPT);
152+
actions.add(XMLSecurityConstants.ENCRYPTION);
153153
properties.setActions(actions);
154154

155155
// Set the key up
@@ -205,7 +205,7 @@ public void testExceptionOnElementToEncryptNotFound() throws Exception {
205205
// Set up the Configuration
206206
XMLSecurityProperties properties = new XMLSecurityProperties();
207207
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
208-
actions.add(XMLSecurityConstants.ENCRYPT);
208+
actions.add(XMLSecurityConstants.ENCRYPTION);
209209
properties.setActions(actions);
210210

211211
// Set the key up
@@ -238,10 +238,19 @@ public void testExceptionOnElementToEncryptNotFound() throws Exception {
238238

239239
@Test
240240
public void testEncryptionElementCreation() throws Exception {
241+
testEncryptElementCreation(XMLSecurityConstants.ENCRYPTION);
242+
}
243+
244+
@Test
245+
public void testEncryptBackwardCompatibility() throws Exception {
246+
testEncryptElementCreation(XMLSecurityConstants.ENCRYPT);
247+
}
248+
249+
private void testEncryptElementCreation(XMLSecurityConstants.Action action) throws Exception {
241250
// Set up the Configuration
242251
XMLSecurityProperties properties = new XMLSecurityProperties();
243252
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
244-
actions.add(XMLSecurityConstants.ENCRYPT);
253+
actions.add(action);
245254
properties.setActions(actions);
246255

247256
// Set the key up
@@ -299,7 +308,7 @@ public void testStrongEncryption() throws Exception {
299308
// Set up the Configuration
300309
XMLSecurityProperties properties = new XMLSecurityProperties();
301310
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
302-
actions.add(XMLSecurityConstants.ENCRYPT);
311+
actions.add(XMLSecurityConstants.ENCRYPTION);
303312
properties.setActions(actions);
304313

305314
// Set the key up
@@ -358,7 +367,7 @@ public void testEncryptionMultipleElements() throws Exception {
358367
// Set up the Configuration
359368
XMLSecurityProperties properties = new XMLSecurityProperties();
360369
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
361-
actions.add(XMLSecurityConstants.ENCRYPT);
370+
actions.add(XMLSecurityConstants.ENCRYPTION);
362371
properties.setActions(actions);
363372

364373
// Set the key up
@@ -412,7 +421,7 @@ public void testAES128ElementAES192KWCipherUsingKEKOutbound() throws Exception {
412421
// Set up the Configuration
413422
XMLSecurityProperties properties = new XMLSecurityProperties();
414423
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
415-
actions.add(XMLSecurityConstants.ENCRYPT);
424+
actions.add(XMLSecurityConstants.ENCRYPTION);
416425
properties.setActions(actions);
417426

418427
// Set the key up
@@ -478,7 +487,7 @@ public void testAES256ElementRSAKWCipherUsingKEKOutbound() throws Exception {
478487
// Set up the Configuration
479488
XMLSecurityProperties properties = new XMLSecurityProperties();
480489
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
481-
actions.add(XMLSecurityConstants.ENCRYPT);
490+
actions.add(XMLSecurityConstants.ENCRYPTION);
482491
properties.setActions(actions);
483492

484493
// Set the key up
@@ -546,7 +555,7 @@ public void testEncryptedKeyKeyValueReference() throws Exception {
546555
// Set up the Configuration
547556
XMLSecurityProperties properties = new XMLSecurityProperties();
548557
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
549-
actions.add(XMLSecurityConstants.ENCRYPT);
558+
actions.add(XMLSecurityConstants.ENCRYPTION);
550559
properties.setActions(actions);
551560

552561
// Set the key up
@@ -615,7 +624,7 @@ public void testEncryptedKeyKeyNameReference() throws Exception {
615624
// Set up the Configuration
616625
XMLSecurityProperties properties = new XMLSecurityProperties();
617626
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
618-
actions.add(XMLSecurityConstants.ENCRYPT);
627+
actions.add(XMLSecurityConstants.ENCRYPTION);
619628
properties.setActions(actions);
620629

621630
// Set the key up
@@ -685,7 +694,7 @@ public void testEncryptedKeyMultipleElements() throws Exception {
685694
// Set up the Configuration
686695
XMLSecurityProperties properties = new XMLSecurityProperties();
687696
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
688-
actions.add(XMLSecurityConstants.ENCRYPT);
697+
actions.add(XMLSecurityConstants.ENCRYPTION);
689698
properties.setActions(actions);
690699

691700
// Set the key up
@@ -749,7 +758,7 @@ public void testEncryptedKeyIssuerSerialReference() throws Exception {
749758
// Set up the Configuration
750759
XMLSecurityProperties properties = new XMLSecurityProperties();
751760
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
752-
actions.add(XMLSecurityConstants.ENCRYPT);
761+
actions.add(XMLSecurityConstants.ENCRYPTION);
753762
properties.setActions(actions);
754763

755764
// Set the key up
@@ -820,7 +829,7 @@ public void testEncryptedKeyX509CertificateReference() throws Exception {
820829
// Set up the Configuration
821830
XMLSecurityProperties properties = new XMLSecurityProperties();
822831
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
823-
actions.add(XMLSecurityConstants.ENCRYPT);
832+
actions.add(XMLSecurityConstants.ENCRYPTION);
824833
properties.setActions(actions);
825834

826835
// Set the key up
@@ -899,7 +908,7 @@ public void testEncryptedKeySKI() throws Exception {
899908
// Set up the Configuration
900909
XMLSecurityProperties properties = new XMLSecurityProperties();
901910
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
902-
actions.add(XMLSecurityConstants.ENCRYPT);
911+
actions.add(XMLSecurityConstants.ENCRYPTION);
903912
properties.setActions(actions);
904913

905914
// Set the key up
@@ -970,7 +979,7 @@ public void testEncryptedKeyX509SubjectName() throws Exception {
970979
// Set up the Configuration
971980
XMLSecurityProperties properties = new XMLSecurityProperties();
972981
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
973-
actions.add(XMLSecurityConstants.ENCRYPT);
982+
actions.add(XMLSecurityConstants.ENCRYPTION);
974983
properties.setActions(actions);
975984

976985
// Set the key up
@@ -1041,7 +1050,7 @@ public void testEncryptedKeyNoKeyInfo() throws Exception {
10411050
// Set up the Configuration
10421051
XMLSecurityProperties properties = new XMLSecurityProperties();
10431052
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1044-
actions.add(XMLSecurityConstants.ENCRYPT);
1053+
actions.add(XMLSecurityConstants.ENCRYPTION);
10451054
properties.setActions(actions);
10461055

10471056
// Set the key up
@@ -1115,7 +1124,7 @@ public void testAES192Element3DESKWCipher() throws Exception {
11151124
// Set up the Configuration
11161125
XMLSecurityProperties properties = new XMLSecurityProperties();
11171126
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1118-
actions.add(XMLSecurityConstants.ENCRYPT);
1127+
actions.add(XMLSecurityConstants.ENCRYPTION);
11191128
properties.setActions(actions);
11201129

11211130
// Set the key up
@@ -1179,7 +1188,7 @@ public void testTripleDesElementCipher() throws Exception {
11791188
// Set up the Configuration
11801189
XMLSecurityProperties properties = new XMLSecurityProperties();
11811190
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1182-
actions.add(XMLSecurityConstants.ENCRYPT);
1191+
actions.add(XMLSecurityConstants.ENCRYPTION);
11831192
properties.setActions(actions);
11841193

11851194
// Set the key up
@@ -1240,7 +1249,7 @@ public void testAes128ElementCipher() throws Exception {
12401249
// Set up the Configuration
12411250
XMLSecurityProperties properties = new XMLSecurityProperties();
12421251
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1243-
actions.add(XMLSecurityConstants.ENCRYPT);
1252+
actions.add(XMLSecurityConstants.ENCRYPTION);
12441253
properties.setActions(actions);
12451254

12461255
// Set the key up
@@ -1303,7 +1312,7 @@ public void testAes192ElementCipher() throws Exception {
13031312
// Set up the Configuration
13041313
XMLSecurityProperties properties = new XMLSecurityProperties();
13051314
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1306-
actions.add(XMLSecurityConstants.ENCRYPT);
1315+
actions.add(XMLSecurityConstants.ENCRYPTION);
13071316
properties.setActions(actions);
13081317

13091318
// Set the key up
@@ -1368,7 +1377,7 @@ public void testAes256ElementCipher() throws Exception {
13681377
// Set up the Configuration
13691378
XMLSecurityProperties properties = new XMLSecurityProperties();
13701379
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1371-
actions.add(XMLSecurityConstants.ENCRYPT);
1380+
actions.add(XMLSecurityConstants.ENCRYPTION);
13721381
properties.setActions(actions);
13731382

13741383
// Set the key up
@@ -1435,7 +1444,7 @@ public void testTripleDesDocumentCipher() throws Exception {
14351444
// Set up the Configuration
14361445
XMLSecurityProperties properties = new XMLSecurityProperties();
14371446
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1438-
actions.add(XMLSecurityConstants.ENCRYPT);
1447+
actions.add(XMLSecurityConstants.ENCRYPTION);
14391448
properties.setActions(actions);
14401449

14411450
// Set the key up
@@ -1497,7 +1506,7 @@ public void testPhysicalRepresentation1() throws Exception {
14971506
// Set up the Configuration
14981507
XMLSecurityProperties properties = new XMLSecurityProperties();
14991508
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1500-
actions.add(XMLSecurityConstants.ENCRYPT);
1509+
actions.add(XMLSecurityConstants.ENCRYPTION);
15011510
properties.setActions(actions);
15021511

15031512
// Set the key up
@@ -1560,7 +1569,7 @@ public void testPhysicalRepresentation2() throws Exception {
15601569
// Set up the Configuration
15611570
XMLSecurityProperties properties = new XMLSecurityProperties();
15621571
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1563-
actions.add(XMLSecurityConstants.ENCRYPT);
1572+
actions.add(XMLSecurityConstants.ENCRYPTION);
15641573
properties.setActions(actions);
15651574

15661575
// Set the key up
@@ -1622,7 +1631,7 @@ public void testTransportKey() throws Exception {
16221631
// Set up the Configuration
16231632
XMLSecurityProperties properties = new XMLSecurityProperties();
16241633
List<XMLSecurityConstants.Action> actions = new ArrayList<>();
1625-
actions.add(XMLSecurityConstants.ENCRYPT);
1634+
actions.add(XMLSecurityConstants.ENCRYPTION);
16261635
properties.setActions(actions);
16271636

16281637
// Set the key up - only specify a transport key, so the session key gets generated

0 commit comments

Comments
 (0)