当前位置: 首页>>代码示例>>Java>>正文


Java Utils.isStringNotBlank方法代码示例

本文整理汇总了Java中eu.europa.esig.dss.utils.Utils.isStringNotBlank方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.isStringNotBlank方法的具体用法?Java Utils.isStringNotBlank怎么用?Java Utils.isStringNotBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eu.europa.esig.dss.utils.Utils的用法示例。


在下文中一共展示了Utils.isStringNotBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serializeNode

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
 * This method is used to serialize a given node
 *
 * @param xmlNode
 *            The node to be serialized.
 * @return
 */
public static byte[] serializeNode(final Node xmlNode) {
	try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
		Transformer transformer = DomUtils.getSecureTransformer();
		Document document = null;
		if (Node.DOCUMENT_NODE == xmlNode.getNodeType()) {
			document = (Document) xmlNode;
		} else {
			document = xmlNode.getOwnerDocument();
		}

		if (document != null) {
			String xmlEncoding = document.getXmlEncoding();
			if (Utils.isStringNotBlank(xmlEncoding)) {
				transformer.setOutputProperty(OutputKeys.ENCODING, xmlEncoding);
			}
		}

		StreamResult result = new StreamResult(bos);
		Source source = new DOMSource(xmlNode);
		transformer.transform(source, result);
		return bos.toByteArray();
	} catch (Exception e) {
		throw new DSSException(e);
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:33,代码来源:DSSXMLUtils.java

示例2: transformReference

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
 * Preconditions:
 * - The reference data is XML
 * - The last transformation is canonicalization.
 *
 * @param reference
 *            {@code DSSReference} to be transformed
 * @return {@code DSSDocument} containing transformed reference's data
 */
@Override
protected DSSDocument transformReference(final DSSReference reference) {

	DSSDocument dssDocument = reference.getContents();
	final List<DSSTransform> transforms = reference.getTransforms();
	if (Utils.isCollectionEmpty(transforms)) {
		return dssDocument;
	}

	// In the case of ENVELOPED signature the document to sign is an XML. However one of the references can point to
	// another document this test case is not taken into account!

	Node nodeToTransform = null;
	final String uri = reference.getUri();
	// Check if the reference is related to the whole document
	if (Utils.isStringNotBlank(uri) && uri.startsWith("#") && !isXPointer(uri)) {

		final Document document = DomUtils.buildDOM(dssDocument);
		DSSXMLUtils.recursiveIdBrowse(document.getDocumentElement());
		final String uri_id = uri.substring(1);
		nodeToTransform = document.getElementById(uri_id);
	}
	byte[] transformedReferenceBytes = applyTransformations(dssDocument, transforms, nodeToTransform);
	return new InMemoryDocument(transformedReferenceBytes);
}
 
开发者ID:esig,项目名称:dss,代码行数:35,代码来源:EnvelopedSignatureBuilder.java

示例3: createTransform

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
static void createTransform(final Document document, final DSSTransform dssTransform, final Element transformDom) {

		transformDom.setAttribute(ALGORITHM, dssTransform.getAlgorithm());

		final String elementName = dssTransform.getElementName();
		final String textContent = dssTransform.getTextContent();
		if (Utils.isStringNotBlank(elementName)) {

			final String namespace = dssTransform.getNamespace();
			DomUtils.addTextElement(document, transformDom, namespace, elementName, textContent);
		} else if (Utils.isStringNotBlank(textContent)) {

			final Document transformContentDoc = DomUtils.buildDOM(textContent);
			final Element contextDocumentElement = transformContentDoc.getDocumentElement();
			document.adoptNode(contextDocumentElement);
			transformDom.appendChild(contextDocumentElement);
		}
	}
 
开发者ID:esig,项目名称:dss,代码行数:19,代码来源:XAdESSignatureBuilder.java

示例4: getXmlContainerInfo

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
private XmlContainerInfo getXmlContainerInfo() {
	if (containerInfo != null) {
		XmlContainerInfo xmlContainerInfo = new XmlContainerInfo();
		xmlContainerInfo.setContainerType(containerInfo.getContainerType().getReadable());
		String zipComment = containerInfo.getZipComment();
		if (Utils.isStringNotBlank(zipComment)) {
			xmlContainerInfo.setZipComment(zipComment);
		}
		xmlContainerInfo.setMimeTypeFilePresent(containerInfo.isMimeTypeFilePresent());
		xmlContainerInfo.setMimeTypeContent(containerInfo.getMimeTypeContent());
		xmlContainerInfo.setContentFiles(containerInfo.getSignedDocumentFilenames());
		xmlContainerInfo.setManifestFiles(getXmlManifests(containerInfo.getManifestFiles()));
		return xmlContainerInfo;
	}
	return null;
}
 
开发者ID:esig,项目名称:dss,代码行数:17,代码来源:DiagnosticDataBuilder.java

示例5: setCanonicalizationMethods

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
protected void setCanonicalizationMethods(final XAdESSignatureParameters params, final String canonicalizationMethod) {

		final String signedInfoCanonicalizationMethod_ = params.getSignedInfoCanonicalizationMethod();
		if (Utils.isStringNotBlank(signedInfoCanonicalizationMethod_)) {
			signedInfoCanonicalizationMethod = signedInfoCanonicalizationMethod_;
		} else {
			signedInfoCanonicalizationMethod = canonicalizationMethod;
		}
		final String signedPropertiesCanonicalizationMethod_ = params.getSignedPropertiesCanonicalizationMethod();
		if (Utils.isStringNotBlank(signedPropertiesCanonicalizationMethod_)) {
			signedPropertiesCanonicalizationMethod = signedPropertiesCanonicalizationMethod_;
		} else {
			signedPropertiesCanonicalizationMethod = canonicalizationMethod;
		}
	}
 
开发者ID:esig,项目名称:dss,代码行数:16,代码来源:XAdESSignatureBuilder.java

示例6: addToBeLoaded

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
 * This methods allows to indicate if the resource must be obtained. If this method has been invoked then only the
 * provided URL will be processed.
 *
 * @param url
 *            to be processed
 */
public void addToBeLoaded(final String url) {

	if (toBeLoaded == null) {

		toBeLoaded = new ArrayList<String>();
	}
	if (Utils.isStringNotBlank(url)) {

		toBeLoaded.add(url);
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:19,代码来源:FileCacheDataLoader.java

示例7: addToBeIgnored

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
 * This methods allows to indicate which resources must be ignored. It is useful in a test environment where some of
 * fake sources a not available. It prevents to wait for the
 * timeout.
 *
 * @param urlString
 *            to be ignored. It can be the original URL or the cache file name
 */
public void addToBeIgnored(final String urlString) {

	if (toIgnored == null) {

		toIgnored = new ArrayList<String>();
	}
	if (Utils.isStringNotBlank(urlString)) {

		final String normalizedFileName = ResourceLoader.getNormalizedFileName(urlString);
		toIgnored.add(normalizedFileName);
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:21,代码来源:FileCacheDataLoader.java

示例8: addContentIdentifier

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
 * ETSI TS 101 733 V2.2.1 (2013-04)
 *
 * 5.10.2 content-identifier Attribute
 * The content-identifier attribute provides an identifier for the signed content, for use when a reference may be
 * later required to that content; for example, in the content-reference attribute in other signed data sent later.
 * The
 * content-identifier shall be a signed attribute. content-identifier attribute type values for the ES have an ASN.1
 * type ContentIdentifier, as defined in
 * ESS (RFC 2634 [5]).
 *
 * The minimal content-identifier attribute should contain a concatenation of user-specific identification
 * information (such as a user name or public keying material identification information), a GeneralizedTime string,
 * and a random number.
 *
 * @param parameters
 * @param signedAttributes
 */
private void addContentIdentifier(final CAdESSignatureParameters parameters, final ASN1EncodableVector signedAttributes) {

	/* this attribute is prohibited in PAdES B */
	if (!padesUsage) {

		final String contentIdentifierPrefix = parameters.getContentIdentifierPrefix();
		if (Utils.isStringNotBlank(contentIdentifierPrefix)) {

			final String contentIdentifierSuffix;
			if (Utils.isStringBlank(parameters.getContentIdentifierSuffix())) {

				final Date now = new Date();
				final String asn1GeneralizedTimeString = new ASN1GeneralizedTime(now).getTimeString();
				final long randomNumber = new Random(now.getTime()).nextLong();
				contentIdentifierSuffix = asn1GeneralizedTimeString + randomNumber;
				parameters.setContentIdentifierSuffix(contentIdentifierSuffix);
			} else {
				contentIdentifierSuffix = parameters.getContentIdentifierSuffix();
			}
			final String contentIdentifierString = contentIdentifierPrefix + contentIdentifierSuffix;
			final ContentIdentifier contentIdentifier = new ContentIdentifier(contentIdentifierString.getBytes());
			final DERSet attrValues = new DERSet(contentIdentifier);
			final Attribute attribute = new Attribute(id_aa_contentIdentifier, attrValues);
			signedAttributes.add(attribute);
		}
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:46,代码来源:CAdESLevelBaselineB.java

示例9: getSignatureFileName

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
protected String getSignatureFileName(final ASiCParameters asicParameters, List<DSSDocument> existingSignatures) {
	if (Utils.isStringNotBlank(asicParameters.getSignatureFileName())) {
		return META_INF + asicParameters.getSignatureFileName();
	}

	int num = Utils.collectionSize(existingSignatures) + 1;
	return ZIP_ENTRY_ASICE_METAINF_CADES_SIGNATURE.replace("001", ASiCUtils.getPadNumber(num));
}
 
开发者ID:esig,项目名称:dss,代码行数:9,代码来源:AbstractDataToSignASiCEWithCAdES.java

示例10: getSignatureFileName

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
protected String getSignatureFileName(final ASiCParameters asicParameters, List<DSSDocument> existingSignatures) {
	if (Utils.isStringNotBlank(asicParameters.getSignatureFileName())) {
		return META_INF + asicParameters.getSignatureFileName();
	}
	if (Utils.isCollectionNotEmpty(existingSignatures)) {
		return ZIP_ENTRY_ASICE_METAINF_XADES_SIGNATURE.replace("001", getSignatureNumber(existingSignatures));
	} else {
		return ZIP_ENTRY_ASICE_METAINF_XADES_SIGNATURE;
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:11,代码来源:AbstractDataToSignASiCEWithXAdES.java

示例11: getContainerTypeFromZipComment

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
private static ASiCContainerType getContainerTypeFromZipComment(String zipComment) {
	if (Utils.isStringNotBlank(zipComment)) {
		int indexOf = zipComment.indexOf(MIME_TYPE_COMMENT);
		if (indexOf > -1) {
			String asicCommentMimeTypeString = zipComment.substring(MIME_TYPE_COMMENT.length() + indexOf);
			MimeType mimeTypeFromZipComment = MimeType.fromMimeTypeString(asicCommentMimeTypeString);
			return getContainerTypeFromMimeType(mimeTypeFromZipComment);
		}
	}
	return null;
}
 
开发者ID:esig,项目名称:dss,代码行数:12,代码来源:ASiCUtils.java

示例12: incorporatePolicy

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
private void incorporatePolicy() {

		final Policy signaturePolicy = params.bLevel().getSignaturePolicy();
		if ((signaturePolicy != null)) {// && (signaturePolicy.getId() != null)) {

			final Element signaturePolicyIdentifierDom = DomUtils.addElement(documentDom, signedSignaturePropertiesDom, XAdES,
					XADES_SIGNATURE_POLICY_IDENTIFIER);

			String signaturePolicyId = signaturePolicy.getId();
			if (Utils.isStringEmpty(signaturePolicyId)) { // implicit
				DomUtils.addElement(documentDom, signaturePolicyIdentifierDom, XAdES, XADES_SIGNATURE_POLICY_IMPLIED);
			} else { // explicit
				final Element signaturePolicyIdDom = DomUtils.addElement(documentDom, signaturePolicyIdentifierDom, XAdES, XADES_SIGNATURE_POLICY_ID);
				final Element sigPolicyIdDom = DomUtils.addElement(documentDom, signaturePolicyIdDom, XAdES, XADES_SIG_POLICY_ID);

				Element identifierDom = DomUtils.addTextElement(documentDom, sigPolicyIdDom, XAdES, XADES_IDENTIFIER, signaturePolicyId);
				String qualifier = signaturePolicy.getQualifier();
				if (Utils.isStringNotBlank(qualifier)) {
					identifierDom.setAttribute(QUALIFIER, qualifier);
				}

				String description = signaturePolicy.getDescription();
				if (Utils.isStringNotEmpty(description)) {
					DomUtils.addTextElement(documentDom, sigPolicyIdDom, XAdES, XADES_DESCRIPTION, description);
				}

				if ((signaturePolicy.getDigestAlgorithm() != null) && (signaturePolicy.getDigestValue() != null)) {

					final Element sigPolicyHashDom = DomUtils.addElement(documentDom, signaturePolicyIdDom, XAdES, XADES_SIG_POLICY_HASH);

					// <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
					final DigestAlgorithm digestAlgorithm = signaturePolicy.getDigestAlgorithm();
					incorporateDigestMethod(sigPolicyHashDom, digestAlgorithm);

					final byte[] hashValue = signaturePolicy.getDigestValue();
					final String bas64EncodedHashValue = Utils.toBase64(hashValue);
					DomUtils.addTextElement(documentDom, sigPolicyHashDom, XMLNS, DS_DIGEST_VALUE, bas64EncodedHashValue);
				}

				String spuri = signaturePolicy.getSpuri();
				if (Utils.isStringNotEmpty(spuri)) {
					Element sigPolicyQualifiers = DomUtils.addElement(documentDom, signaturePolicyIdDom, XAdES, XADES_SIGNATURE_POLICY_QUALIFIERS);
					Element sigPolicyQualifier = DomUtils.addElement(documentDom, sigPolicyQualifiers, XAdES, XADES_SIGNATURE_POLICY_QUALIFIER);

					DomUtils.addTextElement(documentDom, sigPolicyQualifier, XAdES, XADES_SPURI, spuri);
				}
			}
		}
	}
 
开发者ID:esig,项目名称:dss,代码行数:50,代码来源:XAdESSignatureBuilder.java

示例13: check

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
@Override
public boolean check() {
	JoinedPseudoStrategy multiStrategies = new JoinedPseudoStrategy();
	return Utils.isStringNotBlank(multiStrategies.getPseudo(certificate));
}
 
开发者ID:esig,项目名称:dss,代码行数:6,代码来源:CertificateHasPseudoCondition.java

示例14: process

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
@Override
protected boolean process() {
	return Utils.isStringNotBlank(certificate.getSerialNumber());
}
 
开发者ID:esig,项目名称:dss,代码行数:5,代码来源:SerialNumberCheck.java

示例15: process

import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
@Override
protected boolean process() {
	return Utils.isStringNotBlank(zipComment);
}
 
开发者ID:esig,项目名称:dss,代码行数:5,代码来源:ZipCommentPresentCheck.java


注:本文中的eu.europa.esig.dss.utils.Utils.isStringNotBlank方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。