1 /* 2 * Copyright [2006] [University Corporation for Advanced Internet Development, Inc.] 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.opensaml.xml.encryption; 18 19 import org.opensaml.xml.security.credential.Credential; 20 import org.opensaml.xml.security.keyinfo.KeyInfoGenerator; 21 22 /** 23 * Parameters for encrypting XMLObjects. 24 */ 25 public class EncryptionParameters { 26 27 /** Credential used to encrypt. */ 28 private Credential encryptionCredential; 29 30 /** XML Encryption algorithm URI used to encrypt. */ 31 private String algorithm; 32 33 /** Generator for dynamically generating a KeyInfo instance containing information 34 * from the encryption credential. */ 35 private KeyInfoGenerator keyInfoGenerator; 36 37 /** 38 * Constructor. 39 */ 40 public EncryptionParameters() { 41 // This will be the default for auto encryption key generation 42 setAlgorithm(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256); 43 } 44 45 /** 46 * Gets the XML Encryption algorithm URI used to encrypt. 47 * 48 * @return the algorithm URI used to encrypt 49 */ 50 public String getAlgorithm() { 51 return this.algorithm; 52 } 53 54 /** 55 * Sets the XML Encryption algorithm URI used to encrypt. 56 * 57 * @param newAlgorithm the algorithm URI used to encrypt 58 */ 59 public void setAlgorithm(String newAlgorithm) { 60 this.algorithm = newAlgorithm; 61 } 62 63 /** 64 * Gets the credential used to encrypt. 65 * 66 * @return the credential used to encrypt 67 */ 68 public Credential getEncryptionCredential() { 69 return this.encryptionCredential; 70 } 71 72 /** 73 * Sets the credential used to encrypt. 74 * 75 * @param newEncryptionCredential the credential used to encrypt 76 */ 77 public void setEncryptionCredential(Credential newEncryptionCredential) { 78 this.encryptionCredential = newEncryptionCredential; 79 } 80 81 /** 82 * Gets the instance which will be used to generate a KeyInfo 83 * object from the encryption credential. 84 * 85 * @return the generator instance 86 */ 87 public KeyInfoGenerator getKeyInfoGenerator() { 88 return this.keyInfoGenerator; 89 } 90 91 /** 92 * Sets the instance which will be used to generate a KeyInfo 93 * object from the encryption credential. 94 * 95 * @param newKeyInfoGenerator the new generator instance 96 */ 97 public void setKeyInfoGenerator(KeyInfoGenerator newKeyInfoGenerator) { 98 this.keyInfoGenerator = newKeyInfoGenerator; 99 } 100 }