javax.xml.crypto.dsig.spec.DigestMethodParameterSpec Java Examples

The following examples show how to use javax.xml.crypto.dsig.spec.DigestMethodParameterSpec. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #2
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #3
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #4
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #5
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #6
Source File: DOMDigestMethod.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #7
Source File: DOMDigestMethod.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #8
Source File: DOMDigestMethod.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #9
Source File: DOMDigestMethod.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #10
Source File: DOMDigestMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #11
Source File: DOMDigestMethod.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #12
Source File: DOMDigestMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #13
Source File: DOMDigestMethod.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #14
Source File: DOMDigestMethod.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #15
Source File: DOMDigestMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #16
Source File: DOMDigestMethod.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #17
Source File: DOMDigestMethod.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #18
Source File: DOMDigestMethod.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMDigestMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
DOMDigestMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null && !(params instanceof DigestMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type DigestMethodParameterSpec");
    }
    checkParams((DigestMethodParameterSpec)params);
    this.params = (DigestMethodParameterSpec)params;
}
 
Example #19
Source File: DOMDigestMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unmarshals <code>DigestMethodParameterSpec</code> from the specified
 * <code>Element</code>.  By default, this method throws an exception since
 * most DigestMethod algorithms do not have parameters. Subclasses should
 * override it if they have parameters.
 *
 * @param paramsElem the <code>Element</code> holding the input params
 * @return the algorithm-specific <code>DigestMethodParameterSpec</code>
 * @throws MarshalException if the parameters cannot be unmarshalled
 */
DigestMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    throw new MarshalException("no parameters should " +
                               "be specified for the " +
                               getMessageDigestAlgorithm() +
                               " DigestMethod algorithm");
}
 
Example #20
Source File: DOMDigestMethod.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unmarshals <code>DigestMethodParameterSpec</code> from the specified
 * <code>Element</code>.  By default, this method throws an exception since
 * most DigestMethod algorithms do not have parameters. Subclasses should
 * override it if they have parameters.
 *
 * @param paramsElem the <code>Element</code> holding the input params
 * @return the algorithm-specific <code>DigestMethodParameterSpec</code>
 * @throws MarshalException if the parameters cannot be unmarshalled
 */
DigestMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    throw new MarshalException("no parameters should " +
                               "be specified for the " +
                               getMessageDigestAlgorithm() +
                               " DigestMethod algorithm");
}
 
Example #21
Source File: DOMDigestMethod.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Checks if the specified parameters are valid for this algorithm. By
 * default, this method throws an exception if parameters are specified
 * since most DigestMethod algorithms do not have parameters. Subclasses
 * should override it if they have parameters.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
void checkParams(DigestMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for the " + getMessageDigestAlgorithm() +
            " DigestMethod algorithm");
    }
}
 
Example #22
Source File: DOMDigestMethod.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Checks if the specified parameters are valid for this algorithm. By
 * default, this method throws an exception if parameters are specified
 * since most DigestMethod algorithms do not have parameters. Subclasses
 * should override it if they have parameters.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
void checkParams(DigestMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for the " + getMessageDigestAlgorithm() +
            " DigestMethod algorithm");
    }
}
 
Example #23
Source File: DOMDigestMethod.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unmarshals <code>DigestMethodParameterSpec</code> from the specified
 * <code>Element</code>.  By default, this method throws an exception since
 * most DigestMethod algorithms do not have parameters. Subclasses should
 * override it if they have parameters.
 *
 * @param paramsElem the <code>Element</code> holding the input params
 * @return the algorithm-specific <code>DigestMethodParameterSpec</code>
 * @throws MarshalException if the parameters cannot be unmarshalled
 */
DigestMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    throw new MarshalException("no parameters should " +
                               "be specified for the " +
                               getMessageDigestAlgorithm() +
                               " DigestMethod algorithm");
}
 
Example #24
Source File: DOMDigestMethod.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Checks if the specified parameters are valid for this algorithm. By
 * default, this method throws an exception if parameters are specified
 * since most DigestMethod algorithms do not have parameters. Subclasses
 * should override it if they have parameters.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
void checkParams(DigestMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for the " + getMessageDigestAlgorithm() +
            " DigestMethod algorithm");
    }
}
 
Example #25
Source File: DOMDigestMethod.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unmarshals <code>DigestMethodParameterSpec</code> from the specified
 * <code>Element</code>.  By default, this method throws an exception since
 * most DigestMethod algorithms do not have parameters. Subclasses should
 * override it if they have parameters.
 *
 * @param paramsElem the <code>Element</code> holding the input params
 * @return the algorithm-specific <code>DigestMethodParameterSpec</code>
 * @throws MarshalException if the parameters cannot be unmarshalled
 */
DigestMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    throw new MarshalException("no parameters should " +
                               "be specified for the " +
                               getMessageDigestAlgorithm() +
                               " DigestMethod algorithm");
}
 
Example #26
Source File: DOMDigestMethod.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unmarshals <code>DigestMethodParameterSpec</code> from the specified
 * <code>Element</code>.  By default, this method throws an exception since
 * most DigestMethod algorithms do not have parameters. Subclasses should
 * override it if they have parameters.
 *
 * @param paramsElem the <code>Element</code> holding the input params
 * @return the algorithm-specific <code>DigestMethodParameterSpec</code>
 * @throws MarshalException if the parameters cannot be unmarshalled
 */
DigestMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    throw new MarshalException("no parameters should " +
                               "be specified for the " +
                               getMessageDigestAlgorithm() +
                               " DigestMethod algorithm");
}
 
Example #27
Source File: DOMDigestMethod.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Checks if the specified parameters are valid for this algorithm. By
 * default, this method throws an exception if parameters are specified
 * since most DigestMethod algorithms do not have parameters. Subclasses
 * should override it if they have parameters.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
void checkParams(DigestMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for the " + getMessageDigestAlgorithm() +
            " DigestMethod algorithm");
    }
}
 
Example #28
Source File: DOMDigestMethod.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Checks if the specified parameters are valid for this algorithm. By
 * default, this method throws an exception if parameters are specified
 * since most DigestMethod algorithms do not have parameters. Subclasses
 * should override it if they have parameters.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this digest method
 */
void checkParams(DigestMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        throw new InvalidAlgorithmParameterException("no parameters " +
            "should be specified for the " + getMessageDigestAlgorithm() +
            " DigestMethod algorithm");
    }
}
 
Example #29
Source File: DOMDigestMethod.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unmarshals <code>DigestMethodParameterSpec</code> from the specified
 * <code>Element</code>.  By default, this method throws an exception since
 * most DigestMethod algorithms do not have parameters. Subclasses should
 * override it if they have parameters.
 *
 * @param paramsElem the <code>Element</code> holding the input params
 * @return the algorithm-specific <code>DigestMethodParameterSpec</code>
 * @throws MarshalException if the parameters cannot be unmarshalled
 */
DigestMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    throw new MarshalException("no parameters should " +
                               "be specified for the " +
                               getMessageDigestAlgorithm() +
                               " DigestMethod algorithm");
}
 
Example #30
Source File: DOMDigestMethod.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Unmarshals <code>DigestMethodParameterSpec</code> from the specified
 * <code>Element</code>.  By default, this method throws an exception since
 * most DigestMethod algorithms do not have parameters. Subclasses should
 * override it if they have parameters.
 *
 * @param paramsElem the <code>Element</code> holding the input params
 * @return the algorithm-specific <code>DigestMethodParameterSpec</code>
 * @throws MarshalException if the parameters cannot be unmarshalled
 */
DigestMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    throw new MarshalException("no parameters should " +
                               "be specified for the " +
                               getMessageDigestAlgorithm() +
                               " DigestMethod algorithm");
}