View Javadoc

1   /*
2   
3    * Copyright  2003-2004 The Apache Software Foundation.
4   
5    *
6   
7    *  Licensed under the Apache License, Version 2.0 (the "License");
8   
9    *  you may not use this file except in compliance with the License.
10  
11   *  You may obtain a copy of the License at
12  
13   *
14  
15   *      http://www.apache.org/licenses/LICENSE-2.0
16  
17   *
18  
19   *  Unless required by applicable law or agreed to in writing, software
20  
21   *  distributed under the License is distributed on an "AS IS" BASIS,
22  
23   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  
25   *  See the License for the specific language governing permissions and
26  
27   *  limitations under the License.
28  
29   *
30  
31   */
32  
33  
34  
35  package org.apache.ws.security.handler;
36  
37  
38  
39  import org.apache.ws.security.WSConstants;
40  
41  
42  
43  import java.util.Hashtable;
44  
45  import java.util.Map;
46  
47  
48  
49  /***
50  
51   * This class defines the names, actions, and other string for the deployment
52  
53   * data of the WSS handler. Both the Axis handler as well as the JAX-RPC handler
54  
55   * use this class.
56  
57   *  
58  
59   * @author Werner Dittmann (werner@apache.org)
60  
61   */
62  
63  public class WSHandlerConstants {
64  
65  
66  
67      /***
68  
69       * The action parameter. The
70  
71       * handlers use the value of this parameter to determine how
72  
73       * to process the SOAP Envelope. For example in a Axis WSDD file:
74  
75       * <pre>
76  
77       * &lt;handler type="java:org.apache.ws.axis.security.WSDoAllSender">
78  
79       * &lt;parameter name="action" value="UsernameToken"/>
80  
81       * ...
82  
83       * </pre>
84  
85       * orders the handler to attach a <code>UsernameToken</code> to the SOAP
86  
87       * enevelope. It is a blank separated list of actions to perform.
88  
89       * <p/>
90  
91       * The application may set this parameter using the following method:
92  
93       * <pre>
94  
95       * call.setProperty(WSDoAllConstants.ACTION, WSDoAllConstants.USERNAME_TOKEN);
96  
97       * </pre>
98  
99       * However, the parameter in the WSDD deployment file overwrites the
100 
101      * property setting (deployment setting overwrites application setting)
102 
103      */
104 
105     public static final String ACTION = "action";
106 
107     public static final String SEND = "send";
108 
109     public static final String RECEIVE = "receive";
110 
111     /***
112 
113      * Perform nothing.
114 
115      */
116 
117     public static final String NO_SECURITY = "NoSecurity";
118 
119 
120 
121     /***
122 
123      * Perform a UsernameToken identification only.
124 
125      */
126 
127     public static final String USERNAME_TOKEN = "UsernameToken";
128 
129 
130 
131     /***
132 
133      * Perform a SAML Token identification.
134 
135      */
136 
137     public static final String SAML_TOKEN_UNSIGNED = "SAMLTokenUnsigned";
138 
139     public static final String SAML_TOKEN_SIGNED = "SAMLTokenSigned";
140 
141 
142 
143     /***
144 
145      * Perform Signature.
146 
147      * The signature specific parameters define how to sign, which keys
148 
149      * to use, and so on
150 
151      */
152 
153     public static final String SIGNATURE = "Signature";
154 
155 
156 
157     /***
158 
159      * Perform Encryption.
160 
161      * The encryption specific parameters define how to encrypt, which keys
162 
163      * to use, and so on.
164 
165      */
166 
167     public static final String ENCRYPT = "Encrypt";
168 
169 
170 
171     /***
172 
173      * Add a timestamp to the security header.
174 
175      */
176 
177     public static final String TIMESTAMP = "Timestamp";
178 
179 
180 
181     /***
182 
183      * Supress the serialization of the SOAP message.
184 
185      * <p/>
186 
187      * Usually the handler serializes the processed SOAP message into a string
188 
189      * and sets it into the Axis message context as new current message. To
190 
191      * supress this action, define this action. In this case the handler
192 
193      * stores the processed SOAP message as <code>Document</code> in the
194 
195      * Axis message context with the property name <code>SND_SECURITY</code>.
196 
197      * <p/>
198 
199      * A chained handler can retrieve the SOAP message and process it. The
200 
201      * last handler in the chain must set the processed SOAP message as
202 
203      * current message in Axis message context.
204 
205      */
206 
207     public static final String NO_SERIALIZATION = "NoSerialization";
208 
209 
210 
211     /***
212 
213      * Use this to use a specific signature mechanism for .Net.
214 
215      * This signature mechanism uses data from the username token and
216 
217      * a well defined constant string and constructs a signature
218 
219      * key. 
220 
221      */
222 
223     public static final String SIGN_WITH_UT_KEY = "UsernameTokenSignature";
224 
225     /***
226 
227      * This is an interal property name to support handler chaining.
228 
229      * The Axis WSS4J handlers use this message context property to
230 
231      * hand over the SOAP partially processed envelope document to
232 
233      * the next WSS4J handler in the chain.
234 
235      */
236 
237     public static final String SND_SECURITY = "SND_SECURTIY";
238 
239     // public static final String RCV_SECURITY = "RCV_SECURTIY";
240 
241 
242 
243     /***
244 
245      * The actor name of the <code>wsse:Security</code> header.
246 
247      * <p/>
248 
249      * If this parameter is omitted, the actor name is not set. Please
250 
251      * refer to {@link org.apache.axis.Constants#ATTR_ACTOR} and {@link org.apache.axis.Constants#ATTR_ROLE}
252 
253      * about the parameter names. They are set to <code>"actor"</code>
254 
255      * and <code>"role"</code> respectively.
256 
257      * <p/>
258 
259      * The value of the actor or role has to match the receiver's setting
260 
261      * or may contain standard values.
262 
263      * <p/>
264 
265      * The application may set this parameter using the following method:
266 
267      * <pre>
268 
269      * call.setProperty(WSDoAllConstants.ACTOR, "ActorName");
270 
271      * </pre>
272 
273      * However, the parameter in the WSDD deployment file overwrites the
274 
275      * property setting (deployment setting overwrites application setting).
276 
277      *
278 
279      * @see org.apache.axis.Constants#URI_SOAP11_NEXT_ACTOR
280 
281      * @see org.apache.axis.Constants#URI_SOAP12_NEXT_ROLE
282 
283      */
284 
285     public static final String ACTOR = "actor";
286 
287 
288 
289     /***
290 
291      * The role name of the <code>wsse:Security</code> header.
292 
293      * This is used for SOAP 1.2. Refer also to {@link #ACTOR}.
294 
295      */
296 
297     public static final String ROLE = "role";
298 
299 
300 
301     /***
302 
303      * Sets the <code>mustUnderstand</code> flag.
304 
305      * <p/>
306 
307      * If the parameter has the value <code>1</code>
308 
309      * or <code>true</code> the <code>mustUnderstand</code> is set.
310 
311      * The values <code>0</code> or <code>false</code> supress the
312 
313      * flag.
314 
315      * <p/>
316 
317      * The application may set this parameter using the following method:
318 
319      * <pre>
320 
321      * call.setProperty(WSDoAllConstants.MUST_UNDERSTAND, "false");
322 
323      * </pre>
324 
325      * However, the parameter in the WSDD deployment file overwrites the
326 
327      * property setting (deployment setting overwrites application setting).
328 
329      * <p/>
330 
331      * The default setting is <code>true</code>
332 
333      * <p/>
334 
335      * Please refer to {@link org.apache.axis.Constants#ATTR_MUST_UNDERSTAND}
336 
337      * about the parameter name (<code>"mustUnderstand"</code>).
338 
339      */
340 
341     public static final String MUST_UNDERSTAND = "mustUnderstand";
342 
343 
344 
345     /***
346 
347      * The user's name. It is used differently by the WS Security functions.
348 
349      * <ul>
350 
351      * <li>The <i>UsernameToken</i> function sets this name in the
352 
353      * <code>UsernameToken</code>.
354 
355      * </li>
356 
357      * <li>The <i>Signing</i> function uses this name as the alias name
358 
359      * in the keystore to get user's certificate and private key to
360 
361      * perform signing.
362 
363      * </li>
364 
365      * <li>The <i>encryption</i>
366 
367      * functions uses this parameter as fallback if {@link #ENCRYPTION_USER}
368 
369      * is not used.
370 
371      * </li>
372 
373      * </ul>
374 
375      * It is also possible to set the user's name and the according password
376 
377      * via the call function, for example:
378 
379      * <pre>
380 
381      * ...
382 
383      * call.setUsername("name");
384 
385      * call.setPassword("WSS4Java");
386 
387      * ...
388 
389      * </pre>
390 
391      * The user parameter in the deployment descritor (WSDD) file overwrites
392 
393      * the application's setting.
394 
395      * </p>
396 
397      * For an additional way to set the password refer to
398 
399      * {@link #PW_CALLBACK_CLASS} and {@link #PW_CALLBACK_REF}.
400 
401      * <p/>
402 
403      * If the security functions uses the username from the message context, it
404 
405      * clears the username from the message context
406 
407      * after they copied it. This prevents sending of the username in the
408 
409      * HTTP header.
410 
411      * <p/>
412 
413      * In this case the HTTP authentication mechansisms do <b>not</b> work
414 
415      * anymore. User authentication shall be done via the username token or
416 
417      * the certificate verification of the signature certificate.
418 
419      */
420 
421     public static final String USER = "user";
422 
423 
424 
425     /***
426 
427      * The Axis WSS4J handlers provide several ways to get the password required
428 
429      * to construct a username token or to sign a message.
430 
431      * In addition the callback class may check if a username/password
432 
433      * combination is valid. Refer to the documentation of 
434 
435      * {@link org.apache.ws.security.WSPasswordCallback} for more information
436 
437      * about this feature.
438 
439      * <ul>
440 
441      * <li> A class that implements a callback interface (see below). The
442 
443      * handler loads this class and calls the callback method. This
444 
445      * class must have a public default constructor with not parameters.
446 
447      * </li>
448 
449      * <li> The application (or a preceeding handler) sets a reference to an
450 
451      * object that implements the callback interface
452 
453      * </li>
454 
455      * <li> The application sets the password directly using the
456 
457      * <code>setPassword</code> function of the <code>Call</code>.
458 
459      * </ul>
460 
461      * The callback class or callback object shall implement specific password
462 
463      * getter methods, for example reading a database or directory.
464 
465      * <p/>
466 
467      * The handler first checks if it can get a the password via a callback
468 
469      * class. If that fails it checks if it can get the password from the
470 
471      * object reference, if that also fails the handler tries the password
472 
473      * property.
474 
475      * <p/>
476 
477      * The following parameter defines a class that implements a callback
478 
479      * handler interface. The handler loads the class and calls the callback
480 
481      * handler method to get the password. The callback
482 
483      * class needs to implement the
484 
485      * {@link javax.security.auth.callback.CallbackHandler} interface.
486 
487      * <p/>
488 
489      * The callback function
490 
491      * {@link javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])}
492 
493      * gets an array of {@link org.apache.ws.security.WSPasswordCallback}
494 
495      * objects. Only the first entry of the array is used. This object
496 
497      * contains the username/keyname as identifier. The callback handler must
498 
499      * set the password or key associated with this identifier before it returns.
500 
501      * <p/>
502 
503      * The application may set this parameter using the following method:
504 
505      * <pre>
506 
507      * call.setProperty(WSDoAllConstants.PW_CALLBACK_CLASS, "PWCallbackClass");
508 
509      * </pre>
510 
511      * However, the parameter in the WSDD deployment file overwrites the
512 
513      * property setting (deployment setting overwrites application setting).
514 
515      * <p/>
516 
517      * Refer also to comment in {@link #USER} about HTTP authentication
518 
519      * functions.
520 
521      */
522 
523     public static final String PW_CALLBACK_CLASS = "passwordCallbackClass";
524 
525 
526 
527     /***
528 
529      * An application may set an object reference to an object that implements
530 
531      * the {@link javax.security.auth.callback.CallbackHandler} interface.
532 
533      * Only the application can set this property using:
534 
535      * <pre>
536 
537      * call.setProperty(WSDoAllConstants.PW_CALLBACK_REF, anPWCallbackObject);
538 
539      * </pre>
540 
541      * Refer to {@link #PW_CALLBACK_CLASS} for further information about
542 
543      * password callback handling and the priority of the different
544 
545      * methods.
546 
547      * <p/>
548 
549      * Note: every handler that preceeds this handler in the chain can set
550 
551      * this property too. This may be useful on the server side.
552 
553      */
554 
555     public static final String PW_CALLBACK_REF = "passwordCallbackRef";
556 
557 
558 
559     /***
560 
561      * The user's name for encryption.
562 
563      * <p/>
564 
565      * The encryption functions uses the public key of this user's certificate
566 
567      * to encrypt the generated symmetric key.
568 
569      * <p/>
570 
571      * If this parameter is not set, then the encryption
572 
573      * function falls back to the {@link #USER} parameter to get the
574 
575      * certificate.
576 
577      * <p/>
578 
579      * If <b>only</b> encryption of the SOAP body data is requested,
580 
581      * it is recommended to use this parameter to define the username.
582 
583      * The application can then use the standard user and password
584 
585      * functions (see example at {@link #USER} to enable HTTP authentication
586 
587      * functions.
588 
589      * <p/>
590 
591      * Encryption only does not authenticate a user / sender, therefore it
592 
593      * does not need a password.
594 
595      * <p/>
596 
597      * Placing the username of the encryption certficate in the WSDD is not
598 
599      * a security risk, because the public key of that certificate is used
600 
601      * only.
602 
603      * <p/>
604 
605      * The application may set this parameter using the following method:
606 
607      * <pre>
608 
609      * call.setProperty(WSDoAllConstants.ENCYRPTION_USER, "encryptionuser");
610 
611      * </pre>
612 
613      * However, the parameter in the WSDD deployment file overwrites the
614 
615      * property setting (deployment setting overwrites application setting).
616 
617      */
618 
619     public static final String ENCRYPTION_USER = "encryptionUser";
620 
621 
622 
623     /***
624 
625      * Specifying this name as {@link ENCRYPTION_USER}
626 
627      * triggers a special action to get the public key to use for encryption.
628 
629      * The handler uses the public key of the sender's certificate. Using this
630 
631      * way to define an encryption key simplifies certificate management to
632 
633      * a large extend.
634 
635      */
636 
637     public static final String USE_REQ_SIG_CERT = "useReqSigCert";
638 
639 
640 
641     /***
642 
643      * This parameter works in the same way as {@link #PW_CALLBACK_CLASS} but
644 
645      * the Axis WSS4J handler uses it to get the key associated with a key name.
646 
647      */
648 
649     public static final String ENC_CALLBACK_CLASS = "EmbeddedKeyCallbackClass";
650 
651 
652 
653     /***
654 
655      * This parameter works in the same way as {@link #PW_CALLBACK_REF} but
656 
657      * the Axis WSS4J handler uses it to get the key associated with a key name.
658 
659      */
660 
661     public static final String ENC_CALLBACK_REF = "EmbeddedKeyCallbackRef";
662 
663 
664 
665     /***
666 
667      * Text of the key name that needs to be sent
668 
669      */
670 
671     public static final String ENC_KEY_NAME = "EmbeddedKeyName";
672 
673 
674 
675     /***
676 
677      * The name of the crypto propterty file to use for SOAP Signature.
678 
679      * <p/>
680 
681      * The classloader loads this file. Therefore it must be accessible
682 
683      * via the classpath.
684 
685      * <p/>
686 
687      * To locate the implementation of the
688 
689      * {@link org.apache.ws.security.components.crypto.Crypto Crypto}
690 
691      * interface implementation the property file must contain the property
692 
693      * <code>org.apache.ws.security.crypto.provider</code>. The value of
694 
695      * this property is the classname of the implementation class.
696 
697      * <p/>
698 
699      * The following line defines the standard implementation:
700 
701      * <pre>
702 
703      * org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
704 
705      * </pre>
706 
707      * The other contents of the property file depend on the implementation
708 
709      * of the {@link org.apache.ws.security.components.crypto.Crypto Crypto}
710 
711      * interface implementation.
712 
713      * <p/>
714 
715      * The property file of the standard implementation
716 
717      * {@link org.apache.ws.security.components.crypto.Merlin} uses
718 
719      * the following properties:
720 
721      * <pre>
722 
723      * org.apache.ws.security.crypto.provider
724 
725      * org.apache.ws.security.crypto.merlin.file
726 
727      * org.apache.ws.security.crypto.merlin.keystore.type
728 
729      * org.apache.ws.security.crypto.merlin.keystore.provider
730 
731      * org.apache.ws.security.crypto.merlin.keystore.password
732 
733      * org.apache.ws.security.crypto.merlin.keystore.alias
734 
735      * org.apache.ws.security.crypto.merlin.cert.provider
736 
737      * </pre>
738 
739      * The entries are:
740 
741      * <ul>
742 
743      * <li> <code>org.apache.ws.security.crypto.provider</code> see
744 
745      * description above
746 
747      * </li>
748 
749      * <li><code>org.apache.ws.security.crypto.merlin.file</code>
750 
751      * The path to the keystore file. At first the classloader tries to load
752 
753      * this file, if this fails the implementations performs a file system
754 
755      * lookup.
756 
757      * </li>
758 
759      * <li><code>org.apache.ws.security.crypto.merlin.keystore.type</code>
760 
761      * The keystore type, for example <code>JKS</code> for the Java key store.
762 
763      * Other keystore type, such as <code>pkcs12</code> are also possible but depend
764 
765      * on the actual <code>Crypto</code> implementation.
766 
767      * </li>
768 
769      * <li><code>org.apache.ws.security.crypto.merlin.keystore.password</code>
770 
771      * The password to read the keystore. If this property is not set, then
772 
773      * the <code>pwcallback</code>property must be defined.
774 
775      * </li>
776 
777      * </ul>
778 
779      * The application may set this parameter using the following method:
780 
781      * <pre>
782 
783      * call.setProperty(WSDoAllConstants.SIG_PROP_FILE, "myCrypto.properties");
784 
785      * </pre>
786 
787      * However, the parameter in the WSDD deployment file overwrites the
788 
789      * property setting (deployment setting overwrites application setting).
790 
791      * <p/>
792 
793      * If a property file is not set and a signature is requested,
794 
795      * the handler throws an <code>AxisFault</code>.
796 
797      */
798 
799     public static final String SIG_PROP_FILE = "signaturePropFile";
800 
801 
802 
803     /***
804 
805      * The WSDoAllReceiver handler stores a result <code>Vector</code>
806 
807      * in this property.
808 
809      * <p/>
810 
811      * The vector contains <code>WSDoAllReceiverResult</code> objects
812 
813      * for each chained WSDoAllReceiver handler.
814 
815      */
816 
817     public static final String RECV_RESULTS = "RECV_RESULTS";
818 
819 
820 
821     /***
822 
823      * The name of the crypto propterty file to use for SOAP Decryption.
824 
825      * <p/>
826 
827      * Refer to documentation of {@link #SIG_PROP_FILE}.
828 
829      * <p/>
830 
831      * Refer to {@link #SIG_PROP_FILE} for a detail description
832 
833      * about the format and how to use this property file.
834 
835      * <p/>
836 
837      * The application may set this parameter using the following method:
838 
839      * <pre>
840 
841      * call.setProperty(WSDoAllConstants.DEC_PROP_FILE, "myCrypto.properties");
842 
843      * </pre>
844 
845      * However, the parameter in the WSDD deployment file overwrites the
846 
847      * property setting (deployment setting overwrites application setting).
848 
849      * <p/>
850 
851      * If this parameter is not used, but the signature crypto property
852 
853      * file is defined (combined Encryption/Signature action), then the
854 
855      * encryption function uses that file. Otherwise the handler throws
856 
857      * an <code>AxisFault</code>.
858 
859      */
860 
861     public static final String DEC_PROP_FILE = "decryptionPropFile";
862 
863 
864 
865     /***
866 
867      * Specific parameter for UsernameToken action to define the encoding
868 
869      * of the passowrd.
870 
871      * <p/>
872 
873      * The parameter can be set to either {@link WSConstants#PW_DIGEST}
874 
875      * or to {@link WSConstants#PW_TEXT}.
876 
877      * <p/>
878 
879      * The application may set this parameter using the following method:
880 
881      * <pre>
882 
883      * call.setProperty(WSDoAllConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
884 
885      * </pre>
886 
887      * However, the parameter in the WSDD deployment file overwrites the
888 
889      * property setting (deployment setting overwrites application setting).
890 
891      * <p/>
892 
893      * The default setting is PW_DIGEST.
894 
895      */
896 
897     public static final String PASSWORD_TYPE = "passwordType";
898 
899 
900 
901     /***
902 
903      * Parameter to generate additional elements in <code>UsernameToken</code>.
904 
905      * <p/>
906 
907      * The value of this parameter is a list of element names that are added
908 
909      * to the UsernameToken. The names of the list a separated by spaces.
910 
911      * <p/>
912 
913      * The list may containe the names <code>nonce</code> and
914 
915      * <code>created</code> only. Use this option if the password type is
916 
917      * <code>passwordText</code> and the handler shall add the <code>Nonce</code>
918 
919      * and/or <code>Created</code> elements.
920 
921      */
922 
923     public static final String ADD_UT_ELEMENTS = "addUTElements";
924 
925 
926 
927     /***
928 
929      * Defines which key identifier type to use. The WS-Security specifications
930 
931      * recommends to use the identifier type <code>IssuerSerial</code>. For
932 
933      * possible signature key identifier types refer to
934 
935      * {@link #keyIdentifier}. For signature <code>IssuerSerial</code>
936 
937      * and <code>DirectReference</code> are valid only.
938 
939      * <p/>
940 
941      * The application may set this parameter using the following method:
942 
943      * <pre>
944 
945      * call.setProperty(WSDoAllConstants.SIG_KEY_ID, "DirectReference");
946 
947      * </pre>
948 
949      * However, the parameter in the WSDD deployment file overwrites the
950 
951      * property setting (deployment setting overwrites application setting).
952 
953      */
954 
955     public static final String SIG_KEY_ID = "signatureKeyIdentifier";
956 
957 
958 
959     /***
960 
961      * Defines which signature algorithm to use. Currently this
962 
963      * parameter is ignored - SHA1RSA is the only supported algorithm,
964 
965      * will be enhanced soon.
966 
967      * <p/>
968 
969      * The application may set this parameter using the following method:
970 
971      * <pre>
972 
973      * call.setProperty(WSDoAllConstants.SIG_ALGO, "SHA1RSA");
974 
975      * </pre>
976 
977      * However, the parameter in the WSDD deployment file overwrites the
978 
979      * property setting (deployment setting overwrites application setting).
980 
981      */
982 
983     public static final String SIG_ALGO = "signatureAlgorithm";
984 
985 
986 
987     /***
988 
989      * Parameter to define which parts of the request shall be signed.
990 
991      * <p/>
992 
993      * Refer to {@link #ENCRYPTION_PARTS} for a detailed description of
994 
995      * the format of the value string.
996 
997      * <p/>
998 
999      * If this parameter is not specified the handler signs the SOAP Body
1000 
1001      * by default.
1002 
1003      * <p/>
1004 
1005      * The WS Security specifications define several formats to transfer the
1006 
1007      * signature tokens (certificates) or  references to these tokens.
1008 
1009      * Thus, the plain element name <code>Token</code>
1010 
1011      * signs the token and takes care of the different format.
1012 
1013      * <p/>
1014 
1015      * To sign the SOAP body <b>and</b> the signature token the value of this
1016 
1017      * parameter must contain:
1018 
1019      * <pre>
1020 
1021      * &lt;parameter name="signatureParts"
1022 
1023      *   value="{}{http://schemas.xmlsoap.org/soap/envelope/}Body; Token" />
1024 
1025      * </pre>
1026 
1027      * To specify an element without a namespace use the string
1028 
1029      * <code>Null</code> as the namespace name (this is a case sensitive
1030 
1031      * string)
1032 
1033      * <p/>
1034 
1035      * If there is no other element in the request with a local name of
1036 
1037      * <code>Body</code> then the SOAP namespace identifier can be empty
1038 
1039      * (<code>{}</code>).
1040 
1041      */
1042 
1043     public static final String SIGNATURE_PARTS = "signatureParts";
1044 
1045 
1046 
1047     /***
1048 
1049      * The name of the crypto propterty file to use for SOAP Encryption.
1050 
1051      * <p/>
1052 
1053      * Refer to documentation of {@link #SIG_PROP_FILE}.
1054 
1055      * <p/>
1056 
1057      * The application may set this parameter using the following method:
1058 
1059      * <pre>
1060 
1061      * call.setProperty(WSDoAllConstants.ENC_PROP_FILE, "myCrypto.properties");
1062 
1063      * </pre>
1064 
1065      * However, the parameter in the WSDD deployment file overwrites the
1066 
1067      * property setting (deployment setting overwrites application setting).
1068 
1069      * <p/>
1070 
1071      * If this parameter is not used, but the signature crypto property
1072 
1073      * file is defined (combined Encryption/Signature action), then the
1074 
1075      * encryption function uses signature property file. Otherwise the
1076 
1077      * handler throws an <code>AxisFault</code>.
1078 
1079      */
1080 
1081     public static final String ENC_PROP_FILE = "encryptionPropFile";
1082 
1083 
1084 
1085     /***
1086 
1087      * Defines which key identifier type to use. The WS-Security specifications
1088 
1089      * recommends to use the identifier type <code>IssuerSerial</code>. For
1090 
1091      * possible encryption key identifier types refer to
1092 
1093      * {@link #keyIdentifier}. For encryption <code>IssuerSerial</code>
1094 
1095      * and <code>X509KeyIdentifier</code> are valid only.
1096 
1097      * <p/>
1098 
1099      * The application may set this parameter using the following method:
1100 
1101      * <pre>
1102 
1103      * call.setProperty(WSDoAllConstants.ENC_KEY_ID, "X509KeyIdentifier");
1104 
1105      * </pre>
1106 
1107      * However, the parameter in the WSDD deployment file overwrites the
1108 
1109      * property setting (deployment setting overwrites application setting).
1110 
1111      */
1112 
1113     public static final String ENC_KEY_ID = "encryptionKeyIdentifier";
1114 
1115 
1116 
1117     /***
1118 
1119      * Defines which symmetric encryption algorithm to use. WSS4J supports the
1120 
1121      * following alorithms: {@link WSConstants#TRIPLE_DES},
1122 
1123      * {@link WSConstants#AES_128}, {@link WSConstants#AES_256},
1124 
1125      * and {@link WSConstants#AES_192}. Except for AES 192 all of these
1126 
1127      * algorithms are required by the XML Encryption specification.
1128 
1129      * <p/>
1130 
1131      * The application may set this parameter using the following method:
1132 
1133      * <pre>
1134 
1135      * call.setProperty(WSDoAllConstants.ENC_SYM_ALGO, "AES256");
1136 
1137      * </pre>
1138 
1139      * However, the parameter in the WSDD deployment file overwrites the
1140 
1141      * property setting (deployment setting overwrites application setting).
1142 
1143      */
1144 
1145     public static final String ENC_SYM_ALGO = "encryptionSymAlgorithm";
1146 
1147 
1148 
1149     /***
1150 
1151      * Defines which algorithm to use to encrypt the generated symmetric key.
1152 
1153      * Currently WSS4J supports {@link WSConstants#KEYTRANSPORT_RSA15} only.
1154 
1155      * <p/>
1156 
1157      * The application may set this parameter using the following method:
1158 
1159      * <pre>
1160 
1161      * call.setProperty(WSDoAllConstants.ENC_KEY_TRANSPORT, "RSA15");
1162 
1163      * </pre>
1164 
1165      * However, the parameter in the WSDD deployment file overwrites the
1166 
1167      * property setting (deployment setting overwrites application setting).
1168 
1169      */
1170 
1171     public static final String ENC_KEY_TRANSPORT =
1172 
1173             "encryptionKeyTransportAlgorithm";
1174 
1175 
1176 
1177     /***
1178 
1179      * Parameter to define which parts of the request shall be encrypted.
1180 
1181      * <p/>
1182 
1183      * The value of this parameter is a list of semi-colon separated
1184 
1185      * element names that identify the elements to encrypt. An encryption mode
1186 
1187      * specifier and a namespace identification, each inside a pair of curly
1188 
1189      * brackets, may preceed each element name.
1190 
1191      * <p/>
1192 
1193      * The encryption mode specifier is either <code>{Content}</code> or
1194 
1195      * <code>{Element}</code>. Please refer to the W3C XML Encryption
1196 
1197      * specification about the differences between Element and Content
1198 
1199      * encryption. The encryption mode defaults to <code>Content</code>
1200 
1201      * if it is omitted. Example of a list:
1202 
1203      * <pre>
1204 
1205      * &lt;parameter name="encryptionParts"
1206 
1207      *   value="{Content}{http://example.org/paymentv2}CreditCard;
1208 
1209      *             {Element}{}UserName" />
1210 
1211      * </pre>
1212 
1213      * The the first entry of the list identifies the element
1214 
1215      * <code>CreditCard</code> in the namespace
1216 
1217      * <code>http://example.org/paymentv2</code>, and will encrypt its content.
1218 
1219      * Be aware that the element name, the namespace identifier, and the
1220 
1221      * encryption modifier are case sensitive.
1222 
1223      * <p/>
1224 
1225      * The encryption modifier and the namespace identifier can be ommited.
1226 
1227      * In this case the encryption mode defaults to <code>Content</code> and
1228 
1229      * the namespace is set to the SOAP namespace.
1230 
1231      * <p/>
1232 
1233      * An empty encryption mode defaults to <code>Content</code>, an empty
1234 
1235      * namespace identifier defaults to the SOAP namespace.
1236 
1237      * The second line of the example defines <code>Element</code> as
1238 
1239      * encryption mode for an <code>UserName</code> element in the SOAP
1240 
1241      * namespace.
1242 
1243      * <p/>
1244 
1245      * To specify an element without a namespace use the string
1246 
1247      * <code>Null</code> as the namespace name (this is a case sensitive
1248 
1249      * string)
1250 
1251      * <p/>
1252 
1253      * If no list is specified, the handler encrypts the SOAP Body in
1254 
1255      * <code>Content</code> mode by default.
1256 
1257      */
1258 
1259     public static final String ENCRYPTION_PARTS = "encryptionParts";
1260 
1261 
1262 
1263     /***
1264 
1265      * The name of the SAML Issuer factory property file.
1266 
1267      * The classloader loads this file. Therefore it must be accessible
1268 
1269      * via the classpath.
1270 
1271      */
1272 
1273     public static final String SAML_PROP_FILE = "samlPropFile";
1274 
1275 
1276 
1277     /***
1278 
1279      * Time-To-Live is the time difference between creation and expiry time in
1280 
1281      * the WSS Timestamp.
1282 
1283      * The time-to-live in seconds. After this time the SOAP request is
1284 
1285      * invalid (at least the security data shall be treated this way).
1286 
1287      * <p/>
1288 
1289      * If this parameter is not defined, contains a value less or equal
1290 
1291      * zero, or an illegal format the handlers use a default TTL of
1292 
1293      * 300 seconds (5 minutes).
1294 
1295      */
1296 
1297     public static final String TTL_TIMESTAMP = "timeToLive";
1298 
1299 
1300     /***
1301      * Should timestamps have precision in milliseconds
1302      */
1303     public static final String TIMESTAMP_PRECISION = "precisionInMilliseconds";
1304 
1305     /***
1306 
1307      * Define the parameter values to set the key identifier types. These are:
1308 
1309      * <ul>
1310 
1311      * <li><code>DirectReference</code> for {@link WSConstants#BST_DIRECT_REFERENCE}
1312 
1313      * </li>
1314 
1315      * <li><code>IssuerSerial</code> for {@link WSConstants#ISSUER_SERIAL}
1316 
1317      * </li>
1318 
1319      * <li><code>X509KeyIdentifier</code> for {@link WSConstants#X509_KEY_IDENTIFIER}
1320 
1321      * </li>
1322 
1323      * <li><code>SKIKeyIdentifier</code> for {@link WSConstants#SKI_KEY_IDENTIFIER}
1324 
1325      * </li>
1326 
1327      * <li><code>EmbeddedKeyName</code> for {@link WSConstants#EMBEDDED_KEYNAME}
1328 
1329      * </li>
1330 
1331      * </ul
1332 
1333      * See {@link #SIG_KEY_ID} {@link #ENC_KEY_ID}.
1334 
1335      */
1336 
1337     public static Map keyIdentifier = new Hashtable();
1338 
1339 
1340 
1341     static {
1342 
1343         keyIdentifier.put("DirectReference",
1344 
1345                 new Integer(WSConstants.BST_DIRECT_REFERENCE));
1346 
1347         keyIdentifier.put("IssuerSerial",
1348 
1349                 new Integer(WSConstants.ISSUER_SERIAL));
1350 
1351         keyIdentifier.put("X509KeyIdentifier",
1352 
1353                 new Integer(WSConstants.X509_KEY_IDENTIFIER));
1354 
1355         keyIdentifier.put("SKIKeyIdentifier",
1356 
1357                 new Integer(WSConstants.SKI_KEY_IDENTIFIER));
1358 
1359         keyIdentifier.put("EmbeddedKeyName",
1360 
1361                 new Integer(WSConstants.EMBEDDED_KEYNAME));
1362 
1363 
1364 
1365     }
1366 
1367 
1368 
1369 }
1370