1 4 7 package javax.xml.crypto.dsig.dom; 8 9 import javax.xml.crypto.KeySelector; 10 import javax.xml.crypto.dom.DOMCryptoContext; 11 import javax.xml.crypto.dsig.XMLSignContext; 12 import javax.xml.crypto.dsig.XMLSignature; 13 import java.security.Key ; 14 import org.w3c.dom.Node ; 15 16 32 public class DOMSignContext extends DOMCryptoContext implements XMLSignContext { 33 34 private Node parent; 35 private Node nextSibling; 36 37 51 public DOMSignContext(Key signingKey, Node parent) { 52 if (signingKey == null) { 53 throw new NullPointerException ("signingKey cannot be null"); 54 } 55 if (parent == null) { 56 throw new NullPointerException ("parent cannot be null"); 57 } 58 setKeySelector(KeySelector.singletonKeySelector(signingKey)); 59 this.parent = parent; 60 } 61 62 77 public DOMSignContext(Key signingKey, Node parent, Node nextSibling) { 78 if (signingKey == null) { 79 throw new NullPointerException ("signingKey cannot be null"); 80 } 81 if (parent == null) { 82 throw new NullPointerException ("parent cannot be null"); 83 } 84 if (nextSibling == null) { 85 throw new NullPointerException ("nextSibling cannot be null"); 86 } 87 setKeySelector(KeySelector.singletonKeySelector(signingKey)); 88 this.parent = parent; 89 this.nextSibling = nextSibling; 90 } 91 92 104 public DOMSignContext(KeySelector ks, Node parent) { 105 if (ks == null) { 106 throw new NullPointerException ("key selector cannot be null"); 107 } 108 if (parent == null) { 109 throw new NullPointerException ("parent cannot be null"); 110 } 111 setKeySelector(ks); 112 this.parent = parent; 113 } 114 115 127 public DOMSignContext(KeySelector ks, Node parent, Node nextSibling) { 128 if (ks == null) { 129 throw new NullPointerException ("key selector cannot be null"); 130 } 131 if (parent == null) { 132 throw new NullPointerException ("parent cannot be null"); 133 } 134 if (nextSibling == null) { 135 throw new NullPointerException ("nextSibling cannot be null"); 136 } 137 setKeySelector(ks); 138 this.parent = parent; 139 this.nextSibling = nextSibling; 140 } 141 142 150 public void setParent(Node parent) { 151 if (parent == null) { 152 throw new NullPointerException ("parent is null"); 153 } 154 this.parent = parent; 155 } 156 157 165 public void setNextSibling(Node nextSibling) { 166 this.nextSibling = nextSibling; 167 } 168 169 175 public Node getParent() { 176 return parent; 177 } 178 179 185 public Node getNextSibling() { 186 return nextSibling; 187 } 188 } 189 | Popular Tags |