src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/EncryptionMethod.java
branchhttp-client-branch
changeset 56783 7add69e2fb68
parent 56781 4a32a40ce131
parent 50643 f2d94a0619a2
child 56785 62937a37a291
equal deleted inserted replaced
56781:4a32a40ce131 56783:7add69e2fb68
     1 /*
       
     2  * reserved comment block
       
     3  * DO NOT REMOVE OR ALTER!
       
     4  */
       
     5 /**
       
     6  * Licensed to the Apache Software Foundation (ASF) under one
       
     7  * or more contributor license agreements. See the NOTICE file
       
     8  * distributed with this work for additional information
       
     9  * regarding copyright ownership. The ASF licenses this file
       
    10  * to you under the Apache License, Version 2.0 (the
       
    11  * "License"); you may not use this file except in compliance
       
    12  * with the License. You may obtain a copy of the License at
       
    13  *
       
    14  * http://www.apache.org/licenses/LICENSE-2.0
       
    15  *
       
    16  * Unless required by applicable law or agreed to in writing,
       
    17  * software distributed under the License is distributed on an
       
    18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       
    19  * KIND, either express or implied. See the License for the
       
    20  * specific language governing permissions and limitations
       
    21  * under the License.
       
    22  */
       
    23 package com.sun.org.apache.xml.internal.security.encryption;
       
    24 
       
    25 import java.util.Iterator;
       
    26 import org.w3c.dom.Element;
       
    27 
       
    28 /**
       
    29  * {@code EncryptionMethod} describes the encryption algorithm applied to
       
    30  * the cipher data. If the element is absent, the encryption algorithm must be
       
    31  * known by the recipient or the decryption will fail.
       
    32  * <p>
       
    33  * It is defined as follows:
       
    34  * <pre>{@code
       
    35  * <complexType name='EncryptionMethodType' mixed='true'>
       
    36  *     <sequence>
       
    37  *         <element name='KeySize' minOccurs='0' type='xenc:KeySizeType'/>
       
    38  *         <element name='OAEPparams' minOccurs='0' type='base64Binary'/>
       
    39  *         <any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
       
    40  *     </sequence>
       
    41  *     <attribute name='Algorithm' type='anyURI' use='required'/>
       
    42  * </complexType>
       
    43  * }</pre>
       
    44  *
       
    45  * @author Axl Mattheus
       
    46  */
       
    47 public interface EncryptionMethod {
       
    48     /**
       
    49      * Returns the algorithm applied to the cipher data.
       
    50      *
       
    51      * @return the encryption algorithm.
       
    52      */
       
    53     String getAlgorithm();
       
    54 
       
    55     /**
       
    56      * Returns the key size of the key of the algorithm applied to the cipher
       
    57      * data.
       
    58      *
       
    59      * @return the key size.
       
    60      */
       
    61     int getKeySize();
       
    62 
       
    63     /**
       
    64      * Sets the size of the key of the algorithm applied to the cipher data.
       
    65      *
       
    66      * @param size the key size.
       
    67      */
       
    68     void setKeySize(int size);
       
    69 
       
    70     /**
       
    71      * Returns the OAEP parameters of the algorithm applied to the
       
    72      * cipher data.
       
    73      *
       
    74      * @return the OAEP parameters.
       
    75      */
       
    76     byte[] getOAEPparams();
       
    77 
       
    78     /**
       
    79      * Sets the OAEP parameters.
       
    80      *
       
    81      * @param parameters the OAEP parameters.
       
    82      */
       
    83     void setOAEPparams(byte[] parameters);
       
    84 
       
    85     /**
       
    86      * Set the Digest Algorithm to use
       
    87      * @param digestAlgorithm the Digest Algorithm to use
       
    88      */
       
    89     void setDigestAlgorithm(String digestAlgorithm);
       
    90 
       
    91     /**
       
    92      * Get the Digest Algorithm to use
       
    93      * @return the Digest Algorithm to use
       
    94      */
       
    95     String getDigestAlgorithm();
       
    96 
       
    97     /**
       
    98      * Set the MGF Algorithm to use
       
    99      * @param mgfAlgorithm the MGF Algorithm to use
       
   100      */
       
   101     void setMGFAlgorithm(String mgfAlgorithm);
       
   102 
       
   103     /**
       
   104      * Get the MGF Algorithm to use
       
   105      * @return the MGF Algorithm to use
       
   106      */
       
   107     String getMGFAlgorithm();
       
   108 
       
   109     /**
       
   110      * Returns an iterator over all the additional elements contained in the
       
   111      * {@code EncryptionMethod}.
       
   112      *
       
   113      * @return an {@code Iterator} over all the additional information
       
   114      *   about the {@code EncryptionMethod}.
       
   115      */
       
   116     Iterator<Element> getEncryptionMethodInformation();
       
   117 
       
   118     /**
       
   119      * Adds encryption method information.
       
   120      *
       
   121      * @param information additional encryption method information.
       
   122      */
       
   123     void addEncryptionMethodInformation(Element information);
       
   124 
       
   125     /**
       
   126      * Removes encryption method information.
       
   127      *
       
   128      * @param information the information to remove from the
       
   129      *   {@code EncryptionMethod}.
       
   130      */
       
   131     void removeEncryptionMethodInformation(Element information);
       
   132 }