135
136 throw new XMLSecurityException("signature.signatureAlgorithm", exArgs);
137 }
138
139 signatureAlgorithm = getSignatureAlgorithmSpi(algorithmURI);
140 signatureAlgorithm.engineGetContextFromElement(this.constructionElement);
141 }
142
143 /**
144 * Get a SignatureAlgorithmSpi object corresponding to the algorithmURI argument
145 */
146 private static SignatureAlgorithmSpi getSignatureAlgorithmSpi(String algorithmURI)
147 throws XMLSignatureException {
148 try {
149 Class<? extends SignatureAlgorithmSpi> implementingClass =
150 algorithmHash.get(algorithmURI);
151 if (log.isLoggable(java.util.logging.Level.FINE)) {
152 log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
153 + implementingClass + "\"");
154 }
155 return implementingClass.newInstance();
156 } catch (IllegalAccessException ex) {
157 Object exArgs[] = { algorithmURI, ex.getMessage() };
158 throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
159 } catch (InstantiationException ex) {
160 Object exArgs[] = { algorithmURI, ex.getMessage() };
161 throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
162 } catch (NullPointerException ex) {
163 Object exArgs[] = { algorithmURI, ex.getMessage() };
164 throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
165 }
166 }
167
168
169 /**
170 * Proxy method for {@link java.security.Signature#sign()}
171 * which is executed on the internal {@link java.security.Signature} object.
172 *
173 * @return the result of the {@link java.security.Signature#sign()} method
174 * @throws XMLSignatureException
175 */
|
135
136 throw new XMLSecurityException("signature.signatureAlgorithm", exArgs);
137 }
138
139 signatureAlgorithm = getSignatureAlgorithmSpi(algorithmURI);
140 signatureAlgorithm.engineGetContextFromElement(this.constructionElement);
141 }
142
143 /**
144 * Get a SignatureAlgorithmSpi object corresponding to the algorithmURI argument
145 */
146 private static SignatureAlgorithmSpi getSignatureAlgorithmSpi(String algorithmURI)
147 throws XMLSignatureException {
148 try {
149 Class<? extends SignatureAlgorithmSpi> implementingClass =
150 algorithmHash.get(algorithmURI);
151 if (log.isLoggable(java.util.logging.Level.FINE)) {
152 log.log(java.util.logging.Level.FINE, "Create URI \"" + algorithmURI + "\" class \""
153 + implementingClass + "\"");
154 }
155 @SuppressWarnings("deprecation")
156 SignatureAlgorithmSpi result = implementingClass.newInstance();
157 return result;
158 } catch (IllegalAccessException ex) {
159 Object exArgs[] = { algorithmURI, ex.getMessage() };
160 throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
161 } catch (InstantiationException ex) {
162 Object exArgs[] = { algorithmURI, ex.getMessage() };
163 throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
164 } catch (NullPointerException ex) {
165 Object exArgs[] = { algorithmURI, ex.getMessage() };
166 throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs, ex);
167 }
168 }
169
170
171 /**
172 * Proxy method for {@link java.security.Signature#sign()}
173 * which is executed on the internal {@link java.security.Signature} object.
174 *
175 * @return the result of the {@link java.security.Signature#sign()} method
176 * @throws XMLSignatureException
177 */
|