1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.xml.signature.impl;
18
19 import java.util.Collections;
20 import java.util.LinkedList;
21 import java.util.List;
22
23 import org.apache.xml.security.signature.XMLSignature;
24 import org.opensaml.xml.AbstractXMLObject;
25 import org.opensaml.xml.XMLObject;
26 import org.opensaml.xml.security.credential.Credential;
27 import org.opensaml.xml.signature.ContentReference;
28 import org.opensaml.xml.signature.KeyInfo;
29 import org.opensaml.xml.signature.Signature;
30
31
32
33
34 public class SignatureImpl extends AbstractXMLObject implements Signature {
35
36
37 private String canonicalizationAlgorithm;
38
39
40 private String signatureAlgorithm;
41
42
43 private Integer hmacOutputLength;
44
45
46 private Credential signingCredential;
47
48
49 private KeyInfo keyInfo;
50
51
52 private List<ContentReference> contentReferences;
53
54
55 private XMLSignature xmlSignature;
56
57
58
59
60
61
62
63
64 protected SignatureImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
65 super(namespaceURI, elementLocalName, namespacePrefix);
66 contentReferences = new LinkedList<ContentReference>();
67 }
68
69
70 public String getCanonicalizationAlgorithm() {
71 return canonicalizationAlgorithm;
72 }
73
74
75 public void setCanonicalizationAlgorithm(String newAlgorithm) {
76 canonicalizationAlgorithm = prepareForAssignment(canonicalizationAlgorithm, newAlgorithm);
77 }
78
79
80 public String getSignatureAlgorithm() {
81 return signatureAlgorithm;
82 }
83
84
85 public void setSignatureAlgorithm(String newAlgorithm) {
86 signatureAlgorithm = prepareForAssignment(signatureAlgorithm, newAlgorithm);
87 }
88
89
90 public Integer getHMACOutputLength() {
91 return hmacOutputLength;
92 }
93
94
95 public void setHMACOutputLength(Integer length) {
96 hmacOutputLength = prepareForAssignment(hmacOutputLength, length);
97 }
98
99
100 public Credential getSigningCredential() {
101 return signingCredential;
102 }
103
104
105 public void setSigningCredential(Credential newCredential) {
106 signingCredential = prepareForAssignment(signingCredential, newCredential);
107 }
108
109
110 public KeyInfo getKeyInfo() {
111 return keyInfo;
112 }
113
114
115 public void setKeyInfo(KeyInfo newKeyInfo) {
116 keyInfo = prepareForAssignment(keyInfo, newKeyInfo);
117 }
118
119
120 public List<ContentReference> getContentReferences() {
121
122
123 return contentReferences;
124 }
125
126
127 public List<XMLObject> getOrderedChildren() {
128 return Collections.EMPTY_LIST;
129 }
130
131
132 public void releaseDOM() {
133 super.releaseDOM();
134 xmlSignature = null;
135
136
137
138
139
140 if (keyInfo != null) {
141 keyInfo.releaseChildrenDOM(true);
142 keyInfo.releaseDOM();
143 }
144 }
145
146
147
148
149
150
151 public XMLSignature getXMLSignature() {
152 return xmlSignature;
153 }
154
155
156
157
158
159
160 public void setXMLSignature(XMLSignature signature) {
161 xmlSignature = prepareForAssignment(xmlSignature, signature);
162 }
163 }