Java Code Examples for org.apache.xml.security.transforms.Transforms#TRANSFORM_BASE64_DECODE
The following examples show how to use
org.apache.xml.security.transforms.Transforms#TRANSFORM_BASE64_DECODE .
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: XAdESSignatureBuilder.java From dss with GNU Lesser General Public License v2.1 | 4 votes |
/** * Verifies a compatibility of defined signature parameters and reference transformations */ private void checkReferencesValidity() { String referenceWrongMessage = "Reference setting is not correct! "; for (DSSReference reference : params.getReferences()) { List<DSSTransform> transforms = reference.getTransforms(); if (Utils.isCollectionNotEmpty(transforms)) { boolean incorrectUsageOfEnvelopedSignature = false; for (DSSTransform transform : transforms) { switch (transform.getAlgorithm()) { case Transforms.TRANSFORM_BASE64_DECODE: if (params.isEmbedXML()) { throw new DSSException(referenceWrongMessage + "The embedXML(true) parameter is not compatible with base64 transform."); } else if (params.isManifestSignature()) { throw new DSSException(referenceWrongMessage + "Manifest signature is not compatible with base64 transform."); } else if (!SignaturePackaging.ENVELOPING.equals(params.getSignaturePackaging())) { throw new DSSException(referenceWrongMessage + String.format("Base64 transform is not compatible with %s signature format.", params.getSignaturePackaging())); } else if (transforms.size() > 1) { throw new DSSException(referenceWrongMessage + "Base64 transform cannot be used with other transformations."); } break; case Transforms.TRANSFORM_ENVELOPED_SIGNATURE: incorrectUsageOfEnvelopedSignature = true; break; case Transforms.TRANSFORM_C14N11_OMIT_COMMENTS: case Transforms.TRANSFORM_C14N11_WITH_COMMENTS: case Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS: case Transforms.TRANSFORM_C14N_EXCL_WITH_COMMENTS: case Transforms.TRANSFORM_C14N_OMIT_COMMENTS: case Transforms.TRANSFORM_C14N_WITH_COMMENTS: // enveloped signature must follow up by a canonicalization incorrectUsageOfEnvelopedSignature = false; break; default: // do nothing break; } } if (incorrectUsageOfEnvelopedSignature) { throw new DSSException(referenceWrongMessage + "Enveloped Signature Transform must be followed up by a Canonicalization Transform."); } } else { String uri = reference.getUri(); if (Utils.isStringBlank(uri) || DomUtils.isElementReference(uri)) { LOG.warn("A reference with id='{}' and uri='{}' points to an XML Node, while no transforms are defined! " + "The configuration can lead to an unexpected result!", reference.getId(), uri); } if (SignaturePackaging.ENVELOPED.equals(params.getSignaturePackaging()) && Utils.isStringBlank(uri)) { throw new DSSException(referenceWrongMessage + "Enveloped signature must have an enveloped transformation!"); } } } }
Example 2
Source File: Base64Transform.java From dss with GNU Lesser General Public License v2.1 | 4 votes |
public Base64Transform() { super(Transforms.TRANSFORM_BASE64_DECODE); }
Example 3
Source File: Base64Transform.java From dss with GNU Lesser General Public License v2.1 | 4 votes |
public Base64Transform(DSSNamespace xmlDSigNamespace) { super(xmlDSigNamespace, Transforms.TRANSFORM_BASE64_DECODE); }