1 17 package com.sun.org.apache.xml.internal.security.keys.keyresolver; 18 19 20 21 import java.security.PublicKey ; 22 import java.security.cert.X509Certificate ; 23 24 import javax.crypto.SecretKey; 25 26 import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver; 27 import org.w3c.dom.Element ; 28 29 30 43 public abstract class KeyResolverSpi { 44 45 46 static java.util.logging.Logger log = 47 java.util.logging.Logger.getLogger(KeyResolverSpi.class.getName()); 48 49 58 abstract public boolean engineCanResolve(Element element, String BaseURI, 59 StorageResolver storage); 60 61 71 abstract public PublicKey engineResolvePublicKey( 72 Element element, String BaseURI, StorageResolver storage) 73 throws KeyResolverException; 74 75 85 abstract public X509Certificate engineResolveX509Certificate( 86 Element element, String BaseURI, StorageResolver storage) 87 throws KeyResolverException; 88 89 99 abstract public SecretKey engineResolveSecretKey( 100 Element element, String BaseURI, StorageResolver storage) 101 throws KeyResolverException; 102 103 104 protected java.util.Map _properties = new java.util.HashMap (10); 105 106 112 public void engineSetProperty(String key, String value) { 113 114 java.util.Iterator i = this._properties.keySet().iterator(); 115 116 while (i.hasNext()) { 117 String c = (String ) i.next(); 118 119 if (c.equals(key)) { 120 key = c; 121 122 break; 123 } 124 } 125 126 this._properties.put(key, value); 127 } 128 129 135 public String engineGetProperty(String key) { 136 137 java.util.Iterator i = this._properties.keySet().iterator(); 138 139 while (i.hasNext()) { 140 String c = (String ) i.next(); 141 142 if (c.equals(key)) { 143 key = c; 144 145 break; 146 } 147 } 148 149 return (String ) this._properties.get(key); 150 } 151 152 157 public String [] engineGetPropertyKeys() { 158 return new String [0]; 159 } 160 161 167 public boolean understandsProperty(String propertyToTest) { 168 169 String [] understood = this.engineGetPropertyKeys(); 170 171 if (understood != null) { 172 for (int i = 0; i < understood.length; i++) { 173 if (understood[i].equals(propertyToTest)) { 174 return true; 175 } 176 } 177 } 178 179 return false; 180 } 181 } 182 | Popular Tags |