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


Java AttributeTable类代码示例

本文整理汇总了Java中org.bouncycastle.asn1.cms.AttributeTable的典型用法代码示例。如果您正苦于以下问题:Java AttributeTable类的具体用法?Java AttributeTable怎么用?Java AttributeTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: close

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
public void close()
    throws IOException
{
    _out.close();
    _eiGen.close();

    if (unprotectedAttributeGenerator != null)
    {
        AttributeTable attrTable = unprotectedAttributeGenerator.getAttributes(new HashMap());
      
        ASN1Set unprotectedAttrs = new BERSet(attrTable.toASN1EncodableVector());

        _envGen.addObject(new DERTaggedObject(false, 1, unprotectedAttrs));
    }
    
    _envGen.close();
    _cGen.close();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:CMSEnvelopedDataStreamGenerator.java

示例2: SignerInf

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
SignerInf(
    PrivateKey                 key,
    Object                     signerIdentifier,
    String                     digestOID,
    String                     encOID,
    CMSAttributeTableGenerator sAttr,
    CMSAttributeTableGenerator unsAttr,
    AttributeTable             baseSignedTable)
{
    this.key = key;
    this.signerIdentifier = signerIdentifier;
    this.digestOID = digestOID;
    this.encOID = encOID;
    this.sAttr = sAttr;
    this.unsAttr = unsAttr;
    this.baseSignedTable = baseSignedTable;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:CMSSignedDataGenerator.java

示例3: addTimestamp

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
private static CMSSignedData addTimestamp(String tsaUrl, CMSSignedData signedData) throws IOException {

		Collection<SignerInformation> signerInfos = signedData.getSignerInfos().getSigners();

		// get signature of first signer (should be the only one)
		SignerInformation si = signerInfos.iterator().next();
		byte[] signature = si.getSignature();

		// send request to TSA
		byte[] token = TimeStampingClient.getTimeStampToken(tsaUrl, signature, DigestType.SHA1);

		// create new SignerInformation with TS attribute
		Attribute tokenAttr = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken,
				new DERSet(ASN1Primitive.fromByteArray(token)));
		ASN1EncodableVector timestampVector = new ASN1EncodableVector();
		timestampVector.add(tokenAttr);
		AttributeTable at = new AttributeTable(timestampVector);
		si = SignerInformation.replaceUnsignedAttributes(si, at);
		signerInfos.clear();
		signerInfos.add(si);
		SignerInformationStore newSignerStore = new SignerInformationStore(signerInfos);

		// create new signed data
		CMSSignedData newSignedData = CMSSignedData.replaceSigners(signedData, newSignerStore);
		return newSignedData;
	}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:27,代码来源:JarSigner.java

示例4: signTimeStamp

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
/**
 * We are extending CMS Signature
 *
 * @param signer
 *            information about signer
 * @return information about SignerInformation
 */
private SignerInformation signTimeStamp(SignerInformation signer) throws IOException, TSPException {
	AttributeTable unsignedAttributes = signer.getUnsignedAttributes();

	ASN1EncodableVector vector = new ASN1EncodableVector();
	if (unsignedAttributes != null) {
		vector = unsignedAttributes.toASN1EncodableVector();
	}

	byte[] token = tsaClient.getTimeStampToken(signer.getSignature());
	ASN1ObjectIdentifier oid = PKCSObjectIdentifiers.id_aa_signatureTimeStampToken;
	ASN1Encodable signatureTimeStamp = new Attribute(oid, new DERSet(ASN1Primitive.fromByteArray(token)));

	vector.add(signatureTimeStamp);
	Attributes signedAttributes = new Attributes(vector);

	SignerInformation newSigner = SignerInformation.replaceUnsignedAttributes(signer,
			new AttributeTable(signedAttributes));

	return newSigner;
}
 
开发者ID:beat2,项目名称:pdfbox-signer,代码行数:28,代码来源:Signing.java

示例5: verifySignedReferencesToSigningCertificate

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
private boolean verifySignedReferencesToSigningCertificate() {

		final IssuerSerial signingTokenIssuerSerial = DSSASN1Utils.getIssuerSerial(signingCertificateValidity.getCertificateToken());
		final BigInteger signingTokenSerialNumber = signingTokenIssuerSerial.getSerial().getValue();
		final GeneralNames signingTokenIssuerName = signingTokenIssuerSerial.getIssuer();

		final AttributeTable signedAttributes = CMSUtils.getSignedAttributes(signerInformation);
		final Attribute signingCertificateAttributeV1 = signedAttributes.get(id_aa_signingCertificate);
		if (signingCertificateAttributeV1 != null) {

			signingCertificateValidity.setAttributePresent(true);
			verifySigningCertificateV1(signingTokenSerialNumber, signingTokenIssuerName, signingCertificateAttributeV1);
			return true;
		}
		final Attribute signingCertificateAttributeV2 = signedAttributes.get(id_aa_signingCertificateV2);
		if (signingCertificateAttributeV2 != null) {

			signingCertificateValidity.setAttributePresent(true);
			verifySigningCertificateV2(signingTokenSerialNumber, signingTokenIssuerName, signingCertificateAttributeV2);
			return true;
		}
		return false;
	}
 
开发者ID:esig,项目名称:dss,代码行数:24,代码来源:CAdESSignature.java

示例6: getSignedAttributes

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
public AttributeTable getSignedAttributes(final CAdESSignatureParameters parameters) {

		ASN1EncodableVector signedAttributes = new ASN1EncodableVector();

		addSigningCertificateAttribute(parameters, signedAttributes);
		addSigningTimeAttribute(parameters, signedAttributes);
		addSignerAttribute(parameters, signedAttributes);
		addSignaturePolicyId(parameters, signedAttributes);
		addContentHints(parameters, signedAttributes);
		addContentIdentifier(parameters, signedAttributes);
		addCommitmentType(parameters, signedAttributes);
		addSignerLocation(parameters, signedAttributes);
		addContentTimestamps(parameters, signedAttributes);

		// mime-type attribute breaks parallel signatures by adding PKCS7 as a mime-type for subsequent signers.
		// This attribute is not mandatory, so it has been disabled.

		final AttributeTable signedAttributesTable = new AttributeTable(signedAttributes);
		return signedAttributesTable;
	}
 
开发者ID:esig,项目名称:dss,代码行数:21,代码来源:CAdESLevelBaselineB.java

示例7: SignerInf

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
/**
 * 
 * @param key
 * @param cert
 * @param digestOID
 * @param encOID
 * @param sAttr
 * @param unsAttr
 * @param baseSigneTable
 */
SignerInf(
    PrivateKey                 key,
    X509Certificate            cert,
    String                     digestOID,
    String                     encOID,
    CMSAttributeTableGenerator sAttr,
    CMSAttributeTableGenerator unsAttr,
    AttributeTable             baseSigneTable)
{
    this.key = key;
    this.cert = cert;
    this.digestOID = digestOID;
    this.encOID = encOID;
    this.sAttr = sAttr;
    this.unsAttr = unsAttr;
    this.baseSignedTable = baseSigneTable;
}
 
开发者ID:esaito,项目名称:ExemplosDemoiselle,代码行数:28,代码来源:CMSTabeliaoSignedDataGenerator.java

示例8: getDataAssinatura

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
/**
 * Retorna a data da criacao da assinatura
 * NAO EH CARIMBO DE TEMPO 
 * @return Date
 * @see Date
 */
public Date getDataAssinatura(){
	
	try {
		getCertificadoAssinante();
	} catch (Exception e) {
		return null;
	}
       AttributeTable attr = signerInfo.getSignedAttributes();

       if (attr != null)
       {
           Attribute t = attr.get(CMSAttributes.signingTime);
           if (t != null)
           {
               Time   time = Time.getInstance(
                                   t.getAttrValues().getObjectAt(0).getDERObject());
               return time.getDate();
           }
       }
       return null;
}
 
开发者ID:esaito,项目名称:ExemplosDemoiselle,代码行数:28,代码来源:TabeliaoAssinaturaPKCS7.java

示例9: generateEncapsulatedRsa

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
private MimeBodyPart generateEncapsulatedRsa(String digestOid, MimeBodyPart msg) 
    throws Exception
{
    List certList = new ArrayList();

    certList.add(_signCert);
    certList.add(_origCert);

    CertStore certs = CertStore.getInstance("Collection",
                    new CollectionCertStoreParameters(certList), "BC");

    ASN1EncodableVector signedAttrs = generateSignedAttributes();

    SMIMESignedGenerator gen = new SMIMESignedGenerator();

    gen.addSigner(_signKP.getPrivate(), _signCert, digestOid, new AttributeTable(signedAttrs), null);
    gen.addCertificatesAndCRLs(certs);

    return gen.generateEncapsulated(msg, "BC");
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:21,代码来源:SMIMESignedTest.java

示例10: getSignatureTime

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
public static Date getSignatureTime(SignerInformation signer)
{
    AttributeTable atab = signer.getSignedAttributes();
    Date result = null;
    if (atab != null)
    {
        Attribute attr = atab.get(CMSAttributes.signingTime);
        if (attr != null)
        {
            Time t = Time.getInstance(attr.getAttrValues().getObjectAt(0)
                    .toASN1Primitive());
            result = t.getDate();
        }
    }
    return result;
}
 
开发者ID:mlundblad,项目名称:bc-java,代码行数:17,代码来源:SignedMailValidator.java

示例11: getAuthAttrs

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
/**
 * return a table of the digested attributes indexed by
 * the OID of the attribute.
 */
public AttributeTable getAuthAttrs()
{
    if (authAttrs == null)
    {
        return null;
    }

    return new AttributeTable(authAttrs);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:14,代码来源:CMSAuthenticatedData.java

示例12: getUnauthAttrs

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
/**
 * return a table of the undigested attributes indexed by
 * the OID of the attribute.
 */
public AttributeTable getUnauthAttrs()
{
    if (unauthAttrs == null)
    {
        return null;
    }

    return new AttributeTable(unauthAttrs);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:14,代码来源:CMSAuthenticatedData.java

示例13: getSingleValuedSignedAttribute

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
private ASN1Primitive getSingleValuedSignedAttribute(
    ASN1ObjectIdentifier attrOID, String printableName)
    throws CMSException
{
    AttributeTable unsignedAttrTable = this.getUnsignedAttributes();
    if (unsignedAttrTable != null
        && unsignedAttrTable.getAll(attrOID).size() > 0)
    {
        throw new CMSException("The " + printableName
            + " attribute MUST NOT be an unsigned attribute");
    }

    AttributeTable signedAttrTable = this.getSignedAttributes();
    if (signedAttrTable == null)
    {
        return null;
    }

    ASN1EncodableVector v = signedAttrTable.getAll(attrOID);
    switch (v.size())
    {
        case 0:
            return null;
        case 1:
        {
            Attribute t = (Attribute)v.get(0);
            ASN1Set attrValues = t.getAttrValues();
            if (attrValues.size() != 1)
            {
                throw new CMSException("A " + printableName
                    + " attribute MUST have a single attribute value");
            }

            return attrValues.getObjectAt(0).toASN1Primitive();
        }
        default:
            throw new CMSException("The SignedAttributes in a signerInfo MUST NOT include multiple instances of the "
                + printableName + " attribute");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:41,代码来源:SignerInformation.java

示例14: getAttributeSet

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
private ASN1Set getAttributeSet(
    AttributeTable attr)
{
    if (attr != null)
    {
        return new DERSet(attr.toASN1EncodableVector());
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:11,代码来源:SignerInfoGenerator.java

示例15: addSigner

import org.bouncycastle.asn1.cms.AttributeTable; //导入依赖的package包/类
/**
 * add a signer with extra signed/unsigned attributes.
 * @throws NoSuchProviderException 
 * @throws NoSuchAlgorithmException 
 * @throws InvalidKeyException
 * @deprecated use addSignedInfoGenerator
 */
public void addSigner(
    PrivateKey      key,
    X509Certificate cert,
    String          digestOID,
    AttributeTable  signedAttr,
    AttributeTable  unsignedAttr,
    String          sigProvider)
    throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
{
    addSigner(key, cert, digestOID, signedAttr, unsignedAttr,
        CMSUtils.getProvider(sigProvider));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:CMSSignedDataStreamGenerator.java


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