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

The following examples show how to use javax.xml.crypto.dsig.spec.SignatureMethodParameterSpec. 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: DOMHMACSignatureMethod.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMHMACSignatureMethod</code> with the specified params
 *
 * @param params algorithm-specific parameters (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if params are inappropriate
 */
DOMHMACSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #7
Source File: DOMHMACSignatureMethod.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
void checkParams(SignatureMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof HMACParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type HMACParameterSpec");
        }
        outputLength = ((HMACParameterSpec)params).getOutputLength();
        outputLengthSet = true;
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Setting outputLength from HMACParameterSpec to: " + outputLength);
        }
    }
}
 
Example #8
Source File: DOMHMACSignatureMethod.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
SignatureMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    outputLength = Integer.valueOf(paramsElem.getFirstChild().getNodeValue()).intValue();
    outputLengthSet = true;
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "unmarshalled outputLength: " + outputLength);
    }
    return new HMACParameterSpec(outputLength);
}
 
Example #9
Source File: DOMHMACSignatureMethod.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
void checkParams(SignatureMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof HMACParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type HMACParameterSpec");
        }
        outputLength = ((HMACParameterSpec)params).getOutputLength();
        outputLengthSet = true;
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Setting outputLength from HMACParameterSpec to: " + outputLength);
        }
    }
}
 
Example #10
Source File: DOMSignatureMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMSignatureMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this signature method
 */
DOMSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null &&
        !(params instanceof SignatureMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type SignatureMethodParameterSpec");
    }
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #11
Source File: DOMSignatureMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMSignatureMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this signature method
 */
DOMSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null &&
        !(params instanceof SignatureMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type SignatureMethodParameterSpec");
    }
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #12
Source File: DOMHMACSignatureMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
SignatureMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    outputLength = Integer.valueOf(paramsElem.getFirstChild().getNodeValue()).intValue();
    outputLengthSet = true;
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "unmarshalled outputLength: " + outputLength);
    }
    return new HMACParameterSpec(outputLength);
}
 
Example #13
Source File: DOMHMACSignatureMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void checkParams(SignatureMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof HMACParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type HMACParameterSpec");
        }
        outputLength = ((HMACParameterSpec)params).getOutputLength();
        outputLengthSet = true;
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Setting outputLength from HMACParameterSpec to: " + outputLength);
        }
    }
}
 
Example #14
Source File: DOMHMACSignatureMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMHMACSignatureMethod</code> with the specified params
 *
 * @param params algorithm-specific parameters (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if params are inappropriate
 */
DOMHMACSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #15
Source File: DOMSignatureMethod.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMSignatureMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this signature method
 */
DOMSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null &&
        !(params instanceof SignatureMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type SignatureMethodParameterSpec");
    }
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #16
Source File: DOMHMACSignatureMethod.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
SignatureMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    outputLength = Integer.valueOf(paramsElem.getFirstChild().getNodeValue()).intValue();
    outputLengthSet = true;
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "unmarshalled outputLength: " + outputLength);
    }
    return new HMACParameterSpec(outputLength);
}
 
Example #17
Source File: DOMHMACSignatureMethod.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void checkParams(SignatureMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof HMACParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type HMACParameterSpec");
        }
        outputLength = ((HMACParameterSpec)params).getOutputLength();
        outputLengthSet = true;
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Setting outputLength from HMACParameterSpec to: " + outputLength);
        }
    }
}
 
Example #18
Source File: DOMHMACSignatureMethod.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
SignatureMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    outputLength = Integer.valueOf(paramsElem.getFirstChild().getNodeValue()).intValue();
    outputLengthSet = true;
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "unmarshalled outputLength: " + outputLength);
    }
    return new HMACParameterSpec(outputLength);
}
 
Example #19
Source File: DOMHMACSignatureMethod.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMHMACSignatureMethod</code> with the specified params
 *
 * @param params algorithm-specific parameters (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if params are inappropriate
 */
DOMHMACSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #20
Source File: DOMSignatureMethod.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMSignatureMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this signature method
 */
DOMSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null &&
        !(params instanceof SignatureMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type SignatureMethodParameterSpec");
    }
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #21
Source File: DOMHMACSignatureMethod.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
SignatureMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    outputLength = Integer.valueOf(paramsElem.getFirstChild().getNodeValue()).intValue();
    outputLengthSet = true;
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "unmarshalled outputLength: " + outputLength);
    }
    return new HMACParameterSpec(outputLength);
}
 
Example #22
Source File: DOMHMACSignatureMethod.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void checkParams(SignatureMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof HMACParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type HMACParameterSpec");
        }
        outputLength = ((HMACParameterSpec)params).getOutputLength();
        outputLengthSet = true;
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Setting outputLength from HMACParameterSpec to: " + outputLength);
        }
    }
}
 
Example #23
Source File: DOMHMACSignatureMethod.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMHMACSignatureMethod</code> with the specified params
 *
 * @param params algorithm-specific parameters (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if params are inappropriate
 */
DOMHMACSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #24
Source File: DOMSignatureMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMSignatureMethod</code>.
 *
 * @param params the algorithm-specific params (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if the parameters are not
 *    appropriate for this signature method
 */
DOMSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null &&
        !(params instanceof SignatureMethodParameterSpec)) {
        throw new InvalidAlgorithmParameterException
            ("params must be of type SignatureMethodParameterSpec");
    }
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #25
Source File: DOMHMACSignatureMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
SignatureMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    outputLength = Integer.valueOf(paramsElem.getFirstChild().getNodeValue()).intValue();
    outputLengthSet = true;
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "unmarshalled outputLength: " + outputLength);
    }
    return new HMACParameterSpec(outputLength);
}
 
Example #26
Source File: DOMHMACSignatureMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void checkParams(SignatureMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof HMACParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type HMACParameterSpec");
        }
        outputLength = ((HMACParameterSpec)params).getOutputLength();
        outputLengthSet = true;
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Setting outputLength from HMACParameterSpec to: " + outputLength);
        }
    }
}
 
Example #27
Source File: DOMHMACSignatureMethod.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMHMACSignatureMethod</code> with the specified params
 *
 * @param params algorithm-specific parameters (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if params are inappropriate
 */
DOMHMACSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}
 
Example #28
Source File: DOMHMACSignatureMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
SignatureMethodParameterSpec unmarshalParams(Element paramsElem)
    throws MarshalException
{
    outputLength = Integer.valueOf(paramsElem.getFirstChild().getNodeValue()).intValue();
    outputLengthSet = true;
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "unmarshalled outputLength: " + outputLength);
    }
    return new HMACParameterSpec(outputLength);
}
 
Example #29
Source File: DOMHMACSignatureMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void checkParams(SignatureMethodParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params != null) {
        if (!(params instanceof HMACParameterSpec)) {
            throw new InvalidAlgorithmParameterException
                ("params must be of type HMACParameterSpec");
        }
        outputLength = ((HMACParameterSpec)params).getOutputLength();
        outputLengthSet = true;
        if (log.isLoggable(java.util.logging.Level.FINE)) {
            log.log(java.util.logging.Level.FINE, "Setting outputLength from HMACParameterSpec to: " + outputLength);
        }
    }
}
 
Example #30
Source File: DOMHMACSignatureMethod.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a <code>DOMHMACSignatureMethod</code> with the specified params
 *
 * @param params algorithm-specific parameters (may be <code>null</code>)
 * @throws InvalidAlgorithmParameterException if params are inappropriate
 */
DOMHMACSignatureMethod(AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    checkParams((SignatureMethodParameterSpec)params);
    this.params = (SignatureMethodParameterSpec)params;
}