FileDocCategorySizeDatePackage
SignedData.javaAPI DocAzureus 3.0.3.44310Tue Jun 08 05:12:58 BST 2004org.bouncycastle.asn1.pkcs

SignedData

public class SignedData extends Object implements org.bouncycastle.asn1.DEREncodable, PKCSObjectIdentifiers
a PKCS#7 signed data object.

Fields Summary
private org.bouncycastle.asn1.DERInteger
version
private org.bouncycastle.asn1.ASN1Set
digestAlgorithms
private ContentInfo
contentInfo
private org.bouncycastle.asn1.ASN1Set
certificates
private org.bouncycastle.asn1.ASN1Set
crls
private org.bouncycastle.asn1.ASN1Set
signerInfos
Constructors Summary
public SignedData(org.bouncycastle.asn1.DERInteger _version, org.bouncycastle.asn1.ASN1Set _digestAlgorithms, ContentInfo _contentInfo, org.bouncycastle.asn1.ASN1Set _certificates, org.bouncycastle.asn1.ASN1Set _crls, org.bouncycastle.asn1.ASN1Set _signerInfos)

		version          = _version;
		digestAlgorithms = _digestAlgorithms;
		contentInfo      = _contentInfo;
		certificates     = _certificates;
		crls             = _crls;
		signerInfos      = _signerInfos;
	
public SignedData(org.bouncycastle.asn1.ASN1Sequence seq)

        Enumeration     e = seq.getObjects();

        version = (DERInteger)e.nextElement();
        digestAlgorithms = ((ASN1Set)e.nextElement());
        contentInfo = ContentInfo.getInstance(e.nextElement());

        while (e.hasMoreElements())
        {
            DERObject o = (DERObject)e.nextElement();

            //
            // an interesting feature of SignedData is that there appear to be varying implementations...
            // for the moment we ignore anything which doesn't fit.
            //
            if (o instanceof DERTaggedObject)
            {
                DERTaggedObject tagged = (DERTaggedObject)o;

                switch (tagged.getTagNo())
                {
                case 0:
                    certificates = ASN1Set.getInstance(tagged, false);
                    break;
                case 1:
                    crls = ASN1Set.getInstance(tagged, false);
                    break;
                default:
                    throw new IllegalArgumentException("unknown tag value " + tagged.getTagNo());
                }
            }
            else
            {
                signerInfos = (ASN1Set)o;
            }
        }
    
Methods Summary
public org.bouncycastle.asn1.ASN1SetgetCRLs()

        return crls;
    
public org.bouncycastle.asn1.ASN1SetgetCertificates()

        return certificates;
    
public ContentInfogetContentInfo()

        return contentInfo;
    
public org.bouncycastle.asn1.DERObjectgetDERObject()
Produce an object suitable for an ASN1OutputStream.
SignedData ::= SEQUENCE {
version Version,
digestAlgorithms DigestAlgorithmIdentifiers,
contentInfo ContentInfo,
certificates
[0] IMPLICIT ExtendedCertificatesAndCertificates
OPTIONAL,
crls
[1] IMPLICIT CertificateRevocationLists OPTIONAL,
signerInfos SignerInfos }

        ASN1EncodableVector v = new ASN1EncodableVector();

        v.add(version);
        v.add(digestAlgorithms);
        v.add(contentInfo);

        if (certificates != null)
        {
            v.add(new DERTaggedObject(false, 0, certificates));
        }

        if (crls != null)
        {
            v.add(new DERTaggedObject(false, 1, crls));
        }

        v.add(signerInfos);

        return new BERSequence(v);
    
public org.bouncycastle.asn1.ASN1SetgetDigestAlgorithms()

        return digestAlgorithms;
    
public static org.bouncycastle.asn1.pkcs.SignedDatagetInstance(java.lang.Object o)

        if (o instanceof SignedData)
        {
            return (SignedData)o;
        }
        else if (o instanceof ASN1Sequence)
        {
            return new SignedData((ASN1Sequence)o);
        }

        throw new IllegalArgumentException("unknown object in factory: " + o);
    
public org.bouncycastle.asn1.ASN1SetgetSignerInfos()

        return signerInfos;
    
public org.bouncycastle.asn1.DERIntegergetVersion()

        return version;