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.List;
21
22 import org.opensaml.xml.XMLObject;
23 import org.opensaml.xml.signature.X509Certificate;
24 import org.opensaml.xml.util.DatatypeHelper;
25 import org.opensaml.xml.util.IndexingObjectStore;
26 import org.opensaml.xml.validation.AbstractValidatingXMLObject;
27
28
29 public class X509CertificateImpl extends AbstractValidatingXMLObject implements X509Certificate {
30
31
32 private static final IndexingObjectStore<String> B64_CERT_STORE = new IndexingObjectStore<String>();
33
34
35 private String b64CertIndex;
36
37
38
39
40
41
42
43
44 protected X509CertificateImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
45 super(namespaceURI, elementLocalName, namespacePrefix);
46 }
47
48
49 public String getValue() {
50 return B64_CERT_STORE.get(b64CertIndex);
51 }
52
53
54 public void setValue(String newValue) {
55
56 String currentCert = B64_CERT_STORE.get(b64CertIndex);
57 String b64Cert = prepareForAssignment(currentCert, newValue);
58
59
60 if (!DatatypeHelper.safeEquals(currentCert, b64Cert)) {
61 B64_CERT_STORE.remove(b64CertIndex);
62 b64CertIndex = B64_CERT_STORE.put(b64Cert);
63 }
64 }
65
66
67 public List<XMLObject> getOrderedChildren() {
68 return Collections.EMPTY_LIST;
69 }
70
71
72 protected void finalize() throws Throwable {
73 super.finalize();
74 B64_CERT_STORE.remove(b64CertIndex);
75 }
76 }