jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java
changeset 27747 3a271dc8b758
parent 25859 3317bb8137f4
child 33241 27eb2d6abda9
equal deleted inserted replaced
27736:8c9bd4be4a86 27747:3a271dc8b758
     1 /*
     1 /*
     2  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   363      * @return an <code>XMLSignature</code>
   363      * @return an <code>XMLSignature</code>
   364      * @throws NullPointerException if <code>si</code> is <code>null</code>
   364      * @throws NullPointerException if <code>si</code> is <code>null</code>
   365      * @throws ClassCastException if any of the <code>objects</code> are not of
   365      * @throws ClassCastException if any of the <code>objects</code> are not of
   366      *    type <code>XMLObject</code>
   366      *    type <code>XMLObject</code>
   367      */
   367      */
   368     @SuppressWarnings("rawtypes")
       
   369     public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki,
   368     public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki,
   370         List objects, String id, String signatureValueId);
   369         List<? extends XMLObject> objects, String id, String signatureValueId);
   371 
   370 
   372     /**
   371     /**
   373      * Creates a <code>Reference</code> with the specified URI and digest
   372      * Creates a <code>Reference</code> with the specified URI and digest
   374      * method.
   373      * method.
   375      *
   374      *
   397      *    not of type <code>Transform</code>
   396      *    not of type <code>Transform</code>
   398      * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
   397      * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
   399      *    compliant
   398      *    compliant
   400      * @throws NullPointerException if <code>dm</code> is <code>null</code>
   399      * @throws NullPointerException if <code>dm</code> is <code>null</code>
   401      */
   400      */
   402     @SuppressWarnings("rawtypes")
       
   403     public abstract Reference newReference(String uri, DigestMethod dm,
   401     public abstract Reference newReference(String uri, DigestMethod dm,
   404         List transforms, String type, String id);
   402         List<? extends Transform> transforms, String type, String id);
   405 
   403 
   406     /**
   404     /**
   407      * Creates a <code>Reference</code> with the specified parameters and
   405      * Creates a <code>Reference</code> with the specified parameters and
   408      * pre-calculated digest value.
   406      * pre-calculated digest value.
   409      *
   407      *
   428      * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
   426      * @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
   429      *    compliant
   427      *    compliant
   430      * @throws NullPointerException if <code>dm</code> or
   428      * @throws NullPointerException if <code>dm</code> or
   431      *    <code>digestValue</code> is <code>null</code>
   429      *    <code>digestValue</code> is <code>null</code>
   432      */
   430      */
   433     @SuppressWarnings("rawtypes")
       
   434     public abstract Reference newReference(String uri, DigestMethod dm,
   431     public abstract Reference newReference(String uri, DigestMethod dm,
   435         List transforms, String type, String id, byte[] digestValue);
   432         List<? extends Transform> transforms, String type, String id,
       
   433         byte[] digestValue);
   436 
   434 
   437     /**
   435     /**
   438      * Creates a <code>Reference</code> with the specified parameters.
   436      * Creates a <code>Reference</code> with the specified parameters.
   439      *
   437      *
   440      * <p>This method is useful when a list of transforms have already been
   438      * <p>This method is useful when a list of transforms have already been
   471      *    compliant or <code>appliedTransforms</code> is empty
   469      *    compliant or <code>appliedTransforms</code> is empty
   472      * @throws NullPointerException if <code>dm</code>,
   470      * @throws NullPointerException if <code>dm</code>,
   473      *    <code>appliedTransforms</code> or <code>result</code> is
   471      *    <code>appliedTransforms</code> or <code>result</code> is
   474      *    <code>null</code>
   472      *    <code>null</code>
   475      */
   473      */
   476     @SuppressWarnings("rawtypes")
       
   477     public abstract Reference newReference(String uri, DigestMethod dm,
   474     public abstract Reference newReference(String uri, DigestMethod dm,
   478         List appliedTransforms, Data result, List transforms, String type,
   475         List<? extends Transform> appliedTransforms, Data result,
   479         String id);
   476         List<? extends Transform> transforms, String type, String id);
   480 
   477 
   481     /**
   478     /**
   482      * Creates a <code>SignedInfo</code> with the specified canonicalization
   479      * Creates a <code>SignedInfo</code> with the specified canonicalization
   483      * and signature methods, and list of one or more references.
   480      * and signature methods, and list of one or more references.
   484      *
   481      *
   491      *    type <code>Reference</code>
   488      *    type <code>Reference</code>
   492      * @throws IllegalArgumentException if <code>references</code> is empty
   489      * @throws IllegalArgumentException if <code>references</code> is empty
   493      * @throws NullPointerException if any of the parameters
   490      * @throws NullPointerException if any of the parameters
   494      *    are <code>null</code>
   491      *    are <code>null</code>
   495      */
   492      */
   496     @SuppressWarnings("rawtypes")
       
   497     public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
   493     public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
   498         SignatureMethod sm, List references);
   494         SignatureMethod sm, List<? extends Reference> references);
   499 
   495 
   500     /**
   496     /**
   501      * Creates a <code>SignedInfo</code> with the specified parameters.
   497      * Creates a <code>SignedInfo</code> with the specified parameters.
   502      *
   498      *
   503      * @param cm the canonicalization method
   499      * @param cm the canonicalization method
   510      *    type <code>Reference</code>
   506      *    type <code>Reference</code>
   511      * @throws IllegalArgumentException if <code>references</code> is empty
   507      * @throws IllegalArgumentException if <code>references</code> is empty
   512      * @throws NullPointerException if <code>cm</code>, <code>sm</code>, or
   508      * @throws NullPointerException if <code>cm</code>, <code>sm</code>, or
   513      *    <code>references</code> are <code>null</code>
   509      *    <code>references</code> are <code>null</code>
   514      */
   510      */
   515     @SuppressWarnings("rawtypes")
       
   516     public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
   511     public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
   517         SignatureMethod sm, List references, String id);
   512         SignatureMethod sm, List<? extends Reference> references, String id);
   518 
   513 
   519     // Object factory methods
   514     // Object factory methods
   520     /**
   515     /**
   521      * Creates an <code>XMLObject</code> from the specified parameters.
   516      * Creates an <code>XMLObject</code> from the specified parameters.
   522      *
   517      *
   528      * @param encoding the encoding (may be <code>null</code>)
   523      * @param encoding the encoding (may be <code>null</code>)
   529      * @return an <code>XMLObject</code>
   524      * @return an <code>XMLObject</code>
   530      * @throws ClassCastException if <code>content</code> contains any
   525      * @throws ClassCastException if <code>content</code> contains any
   531      *    entries that are not of type {@link XMLStructure}
   526      *    entries that are not of type {@link XMLStructure}
   532      */
   527      */
   533     @SuppressWarnings("rawtypes")
   528     public abstract XMLObject newXMLObject(List<? extends XMLStructure> content,
   534     public abstract XMLObject newXMLObject(List content, String id,
   529         String id, String mimeType, String encoding);
   535         String mimeType, String encoding);
       
   536 
   530 
   537     /**
   531     /**
   538      * Creates a <code>Manifest</code> containing the specified
   532      * Creates a <code>Manifest</code> containing the specified
   539      * list of {@link Reference}s.
   533      * list of {@link Reference}s.
   540      *
   534      *
   545      *    <code>null</code>
   539      *    <code>null</code>
   546      * @throws IllegalArgumentException if <code>references</code> is empty
   540      * @throws IllegalArgumentException if <code>references</code> is empty
   547      * @throws ClassCastException if <code>references</code> contains any
   541      * @throws ClassCastException if <code>references</code> contains any
   548      *    entries that are not of type {@link Reference}
   542      *    entries that are not of type {@link Reference}
   549      */
   543      */
   550     @SuppressWarnings("rawtypes")
   544     public abstract Manifest newManifest(List<? extends Reference> references);
   551     public abstract Manifest newManifest(List references);
       
   552 
   545 
   553     /**
   546     /**
   554      * Creates a <code>Manifest</code> containing the specified
   547      * Creates a <code>Manifest</code> containing the specified
   555      * list of {@link Reference}s and optional id.
   548      * list of {@link Reference}s and optional id.
   556      *
   549      *
   562      *    <code>null</code>
   555      *    <code>null</code>
   563      * @throws IllegalArgumentException if <code>references</code> is empty
   556      * @throws IllegalArgumentException if <code>references</code> is empty
   564      * @throws ClassCastException if <code>references</code> contains any
   557      * @throws ClassCastException if <code>references</code> contains any
   565      *    entries that are not of type {@link Reference}
   558      *    entries that are not of type {@link Reference}
   566      */
   559      */
   567     @SuppressWarnings("rawtypes")
   560     public abstract Manifest newManifest(List<? extends Reference> references,
   568     public abstract Manifest newManifest(List references, String id);
   561         String id);
   569 
   562 
   570     /**
   563     /**
   571      * Creates a <code>SignatureProperty</code> containing the specified
   564      * Creates a <code>SignatureProperty</code> containing the specified
   572      * list of {@link XMLStructure}s, target URI and optional id.
   565      * list of {@link XMLStructure}s, target URI and optional id.
   573      *
   566      *
   581      *    <code>target</code> is <code>null</code>
   574      *    <code>target</code> is <code>null</code>
   582      * @throws IllegalArgumentException if <code>content</code> is empty
   575      * @throws IllegalArgumentException if <code>content</code> is empty
   583      * @throws ClassCastException if <code>content</code> contains any
   576      * @throws ClassCastException if <code>content</code> contains any
   584      *    entries that are not of type {@link XMLStructure}
   577      *    entries that are not of type {@link XMLStructure}
   585      */
   578      */
   586     @SuppressWarnings("rawtypes")
       
   587     public abstract SignatureProperty newSignatureProperty
   579     public abstract SignatureProperty newSignatureProperty
   588         (List content, String target, String id);
   580         (List<? extends XMLStructure> content, String target, String id);
   589 
   581 
   590     /**
   582     /**
   591      * Creates a <code>SignatureProperties</code> containing the specified
   583      * Creates a <code>SignatureProperties</code> containing the specified
   592      * list of {@link SignatureProperty}s and optional id.
   584      * list of {@link SignatureProperty}s and optional id.
   593      *
   585      *
   600      *    is <code>null</code>
   592      *    is <code>null</code>
   601      * @throws IllegalArgumentException if <code>properties</code> is empty
   593      * @throws IllegalArgumentException if <code>properties</code> is empty
   602      * @throws ClassCastException if <code>properties</code> contains any
   594      * @throws ClassCastException if <code>properties</code> contains any
   603      *    entries that are not of type {@link SignatureProperty}
   595      *    entries that are not of type {@link SignatureProperty}
   604      */
   596      */
   605     @SuppressWarnings("rawtypes")
       
   606     public abstract SignatureProperties newSignatureProperties
   597     public abstract SignatureProperties newSignatureProperties
   607         (List properties, String id);
   598         (List<? extends SignatureProperty> properties, String id);
   608 
   599 
   609     // Algorithm factory methods
   600     // Algorithm factory methods
   610     /**
   601     /**
   611      * Creates a <code>DigestMethod</code> for the specified algorithm URI
   602      * Creates a <code>DigestMethod</code> for the specified algorithm URI
   612      * and parameters.
   603      * and parameters.