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


Java SignerInfo.getDigestEncryptionAlgorithm方法代码示例

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


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

示例1: SignerInformation

import org.bouncycastle.asn1.cms.SignerInfo; //导入方法依赖的package包/类
SignerInformation(
    SignerInfo          info,
    ASN1ObjectIdentifier contentType,
    CMSProcessable      content,
    byte[]              resultDigest)
{
    this.info = info;
    this.contentType = contentType;
    this.isCounterSignature = contentType == null;

    SignerIdentifier   s = info.getSID();

    if (s.isTagged())
    {
        ASN1OctetString octs = ASN1OctetString.getInstance(s.getId());

        sid = new SignerId(octs.getOctets());
    }
    else
    {
        IssuerAndSerialNumber   iAnds = IssuerAndSerialNumber.getInstance(s.getId());

        sid = new SignerId(iAnds.getName(), iAnds.getSerialNumber().getValue());
    }

    this.digestAlgorithm = info.getDigestAlgorithm();
    this.signedAttributeSet = info.getAuthenticatedAttributes();
    this.unsignedAttributeSet = info.getUnauthenticatedAttributes();
    this.encryptionAlgorithm = info.getDigestEncryptionAlgorithm();
    this.signature = info.getEncryptedDigest().getOctets();

    this.content = content;
    this.resultDigest = resultDigest;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:35,代码来源:SignerInformation.java

示例2: addCounterSigners

import org.bouncycastle.asn1.cms.SignerInfo; //导入方法依赖的package包/类
/**
 * Return a signer information object with passed in SignerInformationStore representing counter
 * signatures attached as an unsigned attribute.
 *
 * @param signerInformation the signerInfo to be used as the basis.
 * @param counterSigners signer info objects carrying counter signature.
 * @return a copy of the original SignerInformationObject with the changed attributes.
 */
public static SignerInformation addCounterSigners(
    SignerInformation        signerInformation,
    SignerInformationStore   counterSigners)
{
    // TODO Perform checks from RFC 3852 11.4

    SignerInfo          sInfo = signerInformation.info;
    AttributeTable      unsignedAttr = signerInformation.getUnsignedAttributes();
    ASN1EncodableVector v;

    if (unsignedAttr != null)
    {
        v = unsignedAttr.toASN1EncodableVector();
    }
    else
    {
        v = new ASN1EncodableVector();
    }

    ASN1EncodableVector sigs = new ASN1EncodableVector();

    for (Iterator it = counterSigners.getSigners().iterator(); it.hasNext();)
    {
        sigs.add(((SignerInformation)it.next()).toASN1Structure());
    }

    v.add(new Attribute(CMSAttributes.counterSignature, new DERSet(sigs)));

    return new SignerInformation(
            new SignerInfo(sInfo.getSID(), sInfo.getDigestAlgorithm(),
                sInfo.getAuthenticatedAttributes(), sInfo.getDigestEncryptionAlgorithm(), sInfo.getEncryptedDigest(), new DERSet(v)),
                signerInformation.contentType, signerInformation.content, null);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:42,代码来源:SignerInformation.java

示例3: getSignedFields

import org.bouncycastle.asn1.cms.SignerInfo; //导入方法依赖的package包/类
/**
 * 3) Fields version, sid, digestAlgorithm, signedAttrs, signatureAlgorithm, and
 * signature within the SignedData.signerInfos’s item corresponding to the signature being archive
 * time-stamped, in their order of appearance.
 *
 * @param signerInformation
 * @return
 */
private byte[] getSignedFields(final SignerInformation signerInformation) {

	final SignerInfo signerInfo = signerInformation.toASN1Structure();
	final ASN1Integer version = signerInfo.getVersion();
	final SignerIdentifier sid = signerInfo.getSID();
	final AlgorithmIdentifier digestAlgorithm = signerInfo.getDigestAlgorithm();
	final DERTaggedObject signedAttributes = CMSUtils.getDERSignedAttributes(signerInformation);
	final AlgorithmIdentifier digestEncryptionAlgorithm = signerInfo.getDigestEncryptionAlgorithm();
	final ASN1OctetString encryptedDigest = signerInfo.getEncryptedDigest();

	final byte[] derEncodedVersion = DSSASN1Utils.getDEREncoded(version);
	final byte[] derEncodedSid = DSSASN1Utils.getDEREncoded(sid);
	final byte[] derEncodedDigestAlgorithm = DSSASN1Utils.getDEREncoded(digestAlgorithm);
	final byte[] derEncodedSignedAttributes = DSSASN1Utils.getDEREncoded(signedAttributes);
	final byte[] derEncodedDigestEncryptionAlgorithm = DSSASN1Utils.getDEREncoded(digestEncryptionAlgorithm);
	final byte[] derEncodedEncryptedDigest = DSSASN1Utils.getDEREncoded(encryptedDigest);
	if (LOG.isDebugEnabled()) {

		LOG.debug("getSignedFields Version={}", Utils.toBase64(derEncodedVersion));
		LOG.debug("getSignedFields Sid={}", Utils.toBase64(derEncodedSid));
		LOG.debug("getSignedFields DigestAlgorithm={}", Utils.toBase64(derEncodedDigestAlgorithm));
		LOG.debug("getSignedFields SignedAttributes={}", Utils.toBase64(derEncodedSignedAttributes));
		LOG.debug("getSignedFields DigestEncryptionAlgorithm={}", Utils.toBase64(derEncodedDigestEncryptionAlgorithm));
		LOG.debug("getSignedFields EncryptedDigest={}", Utils.toBase64(derEncodedEncryptedDigest));
	}
	final byte[] concatenatedArrays = DSSUtils.concatenate(derEncodedVersion, derEncodedSid, derEncodedDigestAlgorithm, derEncodedSignedAttributes,
			derEncodedDigestEncryptionAlgorithm, derEncodedEncryptedDigest);
	return concatenatedArrays;
}
 
开发者ID:esig,项目名称:dss,代码行数:38,代码来源:CadesLevelBaselineLTATimestampExtractor.java

示例4: addCounterSigners

import org.bouncycastle.asn1.cms.SignerInfo; //导入方法依赖的package包/类
/**
 * Return a signer information object with passed in SignerInformationStore representing counter
 * signatures attached as an unsigned attribute.
 *
 * @param signerInformation the signerInfo to be used as the basis.
 * @param counterSigners signer info objects carrying counter signature.
 * @return a copy of the original SignerInformationObject with the changed attributes.
 */
public static SignerInformation addCounterSigners(
    SignerInformation        signerInformation,
    SignerInformationStore   counterSigners)
{
    // TODO Perform checks from RFC 3852 11.4

    SignerInfo          sInfo = signerInformation.info;
    AttributeTable      unsignedAttr = signerInformation.getUnsignedAttributes();
    ASN1EncodableVector v;

    if (unsignedAttr != null)
    {
        v = unsignedAttr.toASN1EncodableVector();
    }
    else
    {
        v = new ASN1EncodableVector();
    }

    ASN1EncodableVector sigs = new ASN1EncodableVector();

    for (Iterator it = counterSigners.getSigners().iterator(); it.hasNext();)
    {
        sigs.add(((SignerInformation)it.next()).toSignerInfo());
    }

    v.add(new Attribute(CMSAttributes.counterSignature, new DERSet(sigs)));

    return new SignerInformation(
            new SignerInfo(sInfo.getSID(), sInfo.getDigestAlgorithm(),
                sInfo.getAuthenticatedAttributes(), sInfo.getDigestEncryptionAlgorithm(), sInfo.getEncryptedDigest(), new DERSet(v)),
                signerInformation.contentType, signerInformation.content, null);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:42,代码来源:SignerInformation.java


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