public static void main(String[] args) throws NoSuchAlgorithmException { try { TransformService ts = TransformService.getInstance( Transform.BASE64, "DOM", "SomeProviderThatDoesNotExist"); } catch(NoSuchProviderException e) { // this is expected } }
/** * Creates a <code>DOMTransform</code> from an element. It unmarshals any * algorithm-specific input parameters. * * @param transElem a Transform element */ public DOMTransform(Element transElem, XMLCryptoContext context, Provider provider) throws MarshalException { String algorithm = DOMUtils.getAttributeValue(transElem, "Algorithm"); if (provider == null) { try { spi = TransformService.getInstance(algorithm, "DOM"); } catch (NoSuchAlgorithmException e1) { throw new MarshalException(e1); } } else { try { spi = TransformService.getInstance(algorithm, "DOM", provider); } catch (NoSuchAlgorithmException nsae) { try { spi = TransformService.getInstance(algorithm, "DOM"); } catch (NoSuchAlgorithmException e2) { throw new MarshalException(e2); } } } try { spi.init(new javax.xml.crypto.dom.DOMStructure(transElem), context); } catch (InvalidAlgorithmParameterException iape) { throw new MarshalException(iape); } }
public Transform newTransform(String algorithm, XMLStructure params) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException { TransformService spi; try { spi = TransformService.getInstance(algorithm, "DOM"); } catch (NoSuchAlgorithmException nsae) { spi = TransformService.getInstance(algorithm, "DOM", getProvider()); } if (params == null) { spi.init(null); } else { spi.init(params, null); } return new DOMTransform(spi); }
public void dsig() throws Exception { Provider p = Security.getProvider("ApacheXMLDSig"); TransformService.getInstance(Transform.XPATH, "DOM", p); }
/** * Creates a <code>DOMTransform</code>. * * @param spi the TransformService */ public DOMTransform(TransformService spi) { this.spi = spi; }