當前位置: 首頁>>代碼示例>>Java>>正文


Java ASN1EncodableVector.size方法代碼示例

本文整理匯總了Java中org.bouncycastle.asn1.ASN1EncodableVector.size方法的典型用法代碼示例。如果您正苦於以下問題:Java ASN1EncodableVector.size方法的具體用法?Java ASN1EncodableVector.size怎麽用?Java ASN1EncodableVector.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bouncycastle.asn1.ASN1EncodableVector的用法示例。


在下文中一共展示了ASN1EncodableVector.size方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: AttributeTable

import org.bouncycastle.asn1.ASN1EncodableVector; //導入方法依賴的package包/類
public AttributeTable(
    ASN1EncodableVector v)
{
    for (int i = 0; i != v.size(); i++)
    {
        Attribute   a = Attribute.getInstance(v.get(i));

        addAttribute(a.getAttrType(), a);
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:11,代碼來源:AttributeTable.java

示例2: getSingleValuedSignedAttribute

import org.bouncycastle.asn1.ASN1EncodableVector; //導入方法依賴的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

示例3: getCounterSignatures

import org.bouncycastle.asn1.ASN1EncodableVector; //導入方法依賴的package包/類
/**
 * Return a SignerInformationStore containing the counter signatures attached to this
 * signer. If no counter signatures are present an empty store is returned.
 */
public SignerInformationStore getCounterSignatures()
{
    // TODO There are several checks implied by the RFC3852 comments that are missing

    /*
    The countersignature attribute MUST be an unsigned attribute; it MUST
    NOT be a signed attribute, an authenticated attribute, an
    unauthenticated attribute, or an unprotected attribute.
    */        
    AttributeTable unsignedAttributeTable = getUnsignedAttributes();
    if (unsignedAttributeTable == null)
    {
        return new SignerInformationStore(new ArrayList(0));
    }

    List counterSignatures = new ArrayList();

    /*
    The UnsignedAttributes syntax is defined as a SET OF Attributes.  The
    UnsignedAttributes in a signerInfo may include multiple instances of
    the countersignature attribute.
    */
    ASN1EncodableVector allCSAttrs = unsignedAttributeTable.getAll(CMSAttributes.counterSignature);

    for (int i = 0; i < allCSAttrs.size(); ++i)
    {
        Attribute counterSignatureAttribute = (Attribute)allCSAttrs.get(i);            

        /*
        A countersignature attribute can have multiple attribute values.  The
        syntax is defined as a SET OF AttributeValue, and there MUST be one
        or more instances of AttributeValue present.
        */
        ASN1Set values = counterSignatureAttribute.getAttrValues();
        if (values.size() < 1)
        {
            // TODO Throw an appropriate exception?
        }

        for (Enumeration en = values.getObjects(); en.hasMoreElements();)
        {
            /*
            Countersignature values have the same meaning as SignerInfo values
            for ordinary signatures, except that:

               1. The signedAttributes field MUST NOT contain a content-type
                  attribute; there is no content type for countersignatures.

               2. The signedAttributes field MUST contain a message-digest
                  attribute if it contains any other attributes.

               3. The input to the message-digesting process is the contents
                  octets of the DER encoding of the signatureValue field of the
                  SignerInfo value with which the attribute is associated.
            */
            SignerInfo si = SignerInfo.getInstance(en.nextElement());

            counterSignatures.add(new SignerInformation(si, null, new CMSProcessableByteArray(getSignature()), null));
        }
    }

    return new SignerInformationStore(counterSignatures);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:68,代碼來源:SignerInformation.java


注:本文中的org.bouncycastle.asn1.ASN1EncodableVector.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。