1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.xml.encryption.impl;
18
19 import java.util.ArrayList;
20 import java.util.Collections;
21 import java.util.List;
22
23 import javax.xml.namespace.QName;
24
25 import org.opensaml.xml.XMLObject;
26 import org.opensaml.xml.encryption.EncryptionMethod;
27 import org.opensaml.xml.encryption.KeySize;
28 import org.opensaml.xml.encryption.OAEPparams;
29 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
30 import org.opensaml.xml.validation.AbstractValidatingXMLObject;
31
32
33
34
35 public class EncryptionMethodImpl extends AbstractValidatingXMLObject implements EncryptionMethod {
36
37
38 private String algorithm;
39
40
41 private KeySize keySize;
42
43
44 private OAEPparams oaepParams;
45
46
47 private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
48
49
50
51
52
53
54
55
56 protected EncryptionMethodImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
57 super(namespaceURI, elementLocalName, namespacePrefix);
58
59 unknownChildren = new IndexedXMLObjectChildrenList<XMLObject>(this);
60 }
61
62
63 public String getAlgorithm() {
64 return this.algorithm;
65 }
66
67
68 public void setAlgorithm(String newAlgorithm) {
69 this.algorithm = prepareForAssignment(this.algorithm, newAlgorithm);
70 }
71
72
73 public KeySize getKeySize() {
74 return this.keySize;
75 }
76
77
78 public void setKeySize(KeySize newKeySize) {
79 this.keySize = prepareForAssignment(this.keySize, newKeySize);
80 }
81
82
83 public OAEPparams getOAEPparams() {
84 return this.oaepParams;
85 }
86
87
88 public void setOAEPparams(OAEPparams newOAEPparams) {
89 this.oaepParams = prepareForAssignment(this.oaepParams, newOAEPparams);
90 }
91
92
93 public List<XMLObject> getUnknownXMLObjects() {
94 return this.unknownChildren;
95 }
96
97 public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
98 return (List<XMLObject>) unknownChildren.subList(typeOrName);
99 }
100
101
102 public List<XMLObject> getOrderedChildren() {
103 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
104
105 if (keySize != null) {
106 children.add(keySize);
107 }
108 if (oaepParams != null) {
109 children.add(oaepParams);
110 }
111
112 children.addAll(unknownChildren);
113
114 if (children.size() == 0) {
115 return null;
116 }
117
118 return Collections.unmodifiableList(children);
119 }
120
121 }