/** * Validates the specified input and send the augmented validation * result to the specified output. * * <p/> * This method places the following restrictions on the types of * the {@link Source}/{@link Result} accepted. * * <h4>{@link Source}/{@link Result} accepted:</h4> * <table border='1'> * <thead> * <tr> * <td></td> * <td>{@link javax.xml.transform.sax.SAXSource}</td> * <td>{@link javax.xml.transform.dom.DOMSource}</td> * <td>{@link javax.xml.transform.stax.StAXSource}</td> * <td>{@link javax.xml.transform.stream.StreamSource}</td> * </tr> * </thead> * <tbody> * <tr> * <td><tt>null</tt></td> * <td>OK</td> * <td>OK</td> * <td>OK</td> * <td>OK</td> * </tr> * <tr> * <td>{@link javax.xml.transform.sax.SAXResult}</td> * <td>OK</td> * <td>Err</td> * <td>Err</td> * <td>Err</td> * </tr> * <tr> * <td>{@link javax.xml.transform.dom.DOMResult}</td> * <td>Err</td> * <td>OK</td> * <td>Err</td> * <td>Err</td> * </tr> * <tr> * <td>{@link javax.xml.transform.stax.StAXResult}</td> * <td>Err</td> * <td>Err</td> * <td>OK</td> * <td>Err</td> * </tr> * <tr> * <td>{@link javax.xml.transform.stream.StreamResult}</td> * <td>Err</td> * <td>Err</td> * <td>Err</td> * <td>OK</td> * </tr> * </tbody> * </table> * * <p/> * To validate one {@link Source} into another kind of {@link Result}, use the identity transformer * (see {@link javax.xml.transform.TransformerFactory#newTransformer()}). * * <p/> * Errors found during the validation is sent to the specified * {@link ErrorHandler}. * * <p/> * If a document is valid, or if a document contains some errors * but none of them were fatal and the {@link ErrorHandler} didn't * throw any exception, then the method returns normally. * * @param source * XML to be validated. Must not be null. * * @param result * The {@link Result} object that receives (possibly augmented) * XML. This parameter can be null if the caller is not interested * in it. * * Note that when a {@link javax.xml.transform.dom.DOMResult} is used, * a validator might just pass the same DOM node from * {@link javax.xml.transform.dom.DOMSource} to * {@link javax.xml.transform.dom.DOMResult} * (in which case <tt>source.getNode()==result.getNode()</tt>), * it might copy the entire DOM tree, or it might alter the * node given by the source. * * @throws IllegalArgumentException * If the {@link Result} type doesn't match the {@link Source} type, * or if the specified source is not a * {@link javax.xml.transform.sax.SAXSource}, * {@link javax.xml.transform.dom.DOMSource}, * {@link javax.xml.transform.stax.StAXSource} or * {@link javax.xml.transform.stream.StreamSource}. * * @throws SAXException * If the {@link ErrorHandler} throws a {@link SAXException} or * if a fatal error is found and the {@link ErrorHandler} returns * normally. * * @throws IOException * If the validator is processing a * {@link javax.xml.transform.sax.SAXSource} and the * underlying {@link org.xml.sax.XMLReader} throws an * {@link IOException}. * * @throws NullPointerException * If the <tt>source</tt> parameter is null. * * @see #validate(Source) */ public abstract void validate(javax.xml.transform.Source source, javax.xml.transform.Result result);
/** * Attempts to find a key that satisfies the specified constraints. * * @param keyInfo a <code>KeyInfo</code> (may be <code>null</code>) * @param purpose the key's purpose ({@link Purpose#SIGN}, * {@link Purpose#VERIFY}, {@link Purpose#ENCRYPT}, or * {@link Purpose#DECRYPT}) * @param method the algorithm method that this key is to be used for. * Only keys that are compatible with the algorithm and meet the * constraints of the specified algorithm should be returned. * @param context an <code>XMLCryptoContext</code> that may contain * useful information for finding an appropriate key. If this key * selector supports resolving {@link RetrievalMethod} types, the * context's <code>baseURI</code> and <code>dereferencer</code> * parameters (if specified) should be used by the selector to * resolve and dereference the URI. * @return the result of the key selector * @throws KeySelectorException if an exceptional condition occurs while * attempting to find a key. Note that an inability to find a key is not * considered an exception (<code>null</code> should be * returned in that case). However, an error condition (ex: network * communications failure) that prevented the <code>KeySelector</code> * from finding a potential key should be considered an exception. * @throws ClassCastException if the data type of <code>method</code> * is not supported by this key selector */ public abstract KeySelectorResult select(javax.xml.crypto.dsig.keyinfo.KeyInfo keyInfo, Purpose purpose, AlgorithmMethod method, XMLCryptoContext context);
/** * Validates the specified input. * * <p/> * This is just a convenience method of: * <pre> * validate(source,null); * </pre> * * @see #setErrorHandler(ErrorHandler) */ public void validate(javax.xml.transform.Source source) { //throws SAXException, IOException { validate (source, null); }
/** * <p/>Set the {@link Schema} to be used by parsers created * from this factory. * * <p/> * When a {@link Schema} is non-null, a parser will use a validator * created from it to validate documents before it passes information * down to the application. * * <p/>When errors are found by the validator, the parser is responsible * to report them to the user-specified {@link org.xml.sax.ErrorHandler} * (or if the error handler is not set, ignore them or throw them), just * like any other errors found by the parser itself. * In other words, if the user-specified {@link org.xml.sax.ErrorHandler} * is set, it must receive those errors, and if not, they must be * treated according to the implementation specific * default error handling rules. * * <p/> * A validator may modify the outcome of a parse (for example by * adding default values that were missing in documents), and a parser * is responsible to make sure that the application will receive * modified DOM trees. * * <p/> * Initially, null is set as the {@link Schema}. * * <p/> * This processing will take effect even if * the {@link #isValidating()} method returns <tt>false</tt>. * * <p>It is an error to use * the <code>http://java.sun.com/xml/jaxp/properties/schemaSource</code> * property and/or the <code>http://java.sun.com/xml/jaxp/properties/schemaLanguage</code> * property in conjunction with a {@link Schema} object. * Such configuration will cause a {@link ParserConfigurationException} * exception when the {@link #newDocumentBuilder()} is invoked.</p> * * * <h4>Note for implementors</h4> * <p/> * A parser must be able to work with any {@link Schema} * implementation. However, parsers and schemas are allowed * to use implementation-specific custom mechanisms * as long as they yield the result described in the specification. * * @param schema <code>Schema</code> to use or <code>null</code> to remove a schema. * * @throws UnsupportedOperationException * For backward compatibility, when implementations for * earlier versions of JAXP is used, this exception will be * thrown. * * @since 1.5 */ public void setSchema(javax.xml.validation.Schema schema) { throw new java.lang.UnsupportedOperationException ( "This parser does not support specification \"" + this.getClass ().getPackage ().getSpecificationTitle () + "\" version \"" + this.getClass ().getPackage ().getSpecificationVersion () + "\"" ); }
public override KeySelectorResult select(javax.xml.crypto.dsig.keyinfo.KeyInfo keyInfo, Purpose purpose, AlgorithmMethod method, XMLCryptoContext context) { //throws KeySelectorException { return new IAC_KeySelectorResult(this); }
public MimeMessage(javax.mail.Session session) : base(session) { }
/** * Creates an <code>XMLSignature</code> and initializes it with the * specified parameters. * * @param si the signed info * @param ki the key info (may be <code>null</code>) * @param objects a list of {@link XMLObject}s (may be empty or * <code>null</code>) * @param id the Id (may be <code>null</code>) * @param signatureValueId the SignatureValue Id (may be <code>null</code>) * @return an <code>XMLSignature</code> * @throws NullPointerException if <code>si</code> is <code>null</code> * @throws ClassCastException if any of the <code>objects</code> are not of * type <code>XMLObject</code> */ public abstract XMLSignature newXMLSignature(SignedInfo si, javax.xml.crypto.dsig.keyinfo.KeyInfo ki, java.util.List<Object> objects, String id, String signatureValueId);
/** * Creates an <code>XMLSignature</code> and initializes it with the contents * of the specified <code>SignedInfo</code> and <code>KeyInfo</code> * objects. * * @param si the signed info * @param ki the key info (may be <code>null</code>) * @return an <code>XMLSignature</code> * @throws NullPointerException if <code>si</code> is <code>null</code> */ public abstract XMLSignature newXMLSignature(SignedInfo si, javax.xml.crypto.dsig.keyinfo.KeyInfo ki);
//InvalidAlgorithmParameterException; /** * Creates a <code>SignatureMethod</code> for the specified algorithm URI * and parameters. * * @param algorithm the URI identifying the signature algorithm * @param params algorithm-specific signature parameters (may be * <code>null</code>) * @return the <code>SignatureMethod</code> * @throws InvalidAlgorithmParameterException if the specified parameters * are inappropriate for the requested algorithm * @throws NoSuchAlgorithmException if an implementation of the * specified algorithm cannot be found * @throws NullPointerException if <code>algorithm</code> is * <code>null</code> */ public abstract SignatureMethod newSignatureMethod(String algorithm, javax.xml.crypto.dsig.spec.SignatureMethodParameterSpec paramsJ);
// Algorithm factory methods /** * Creates a <code>DigestMethod</code> for the specified algorithm URI * and parameters. * * @param algorithm the URI identifying the digest algorithm * @param params algorithm-specific digest parameters (may be * <code>null</code>) * @return the <code>DigestMethod</code> * @throws InvalidAlgorithmParameterException if the specified parameters * are inappropriate for the requested algorithm * @throws NoSuchAlgorithmException if an implementation of the * specified algorithm cannot be found * @throws NullPointerException if <code>algorithm</code> is * <code>null</code> */ public abstract DigestMethod newDigestMethod(String algorithm, javax.xml.crypto.dsig.spec.DigestMethodParameterSpec paramsJ);