Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.cms;
  
  
Parse AuthenticatedData stream.
 AuthenticatedData ::= SEQUENCE {
       version CMSVersion,
       originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
       recipientInfos RecipientInfos,
       macAlgorithm MessageAuthenticationCodeAlgorithm,
       digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
       encapContentInfo EncapsulatedContentInfo,
       authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
       mac MessageAuthenticationCode,
       unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }

 AuthAttributes ::= SET SIZE (1..MAX) OF Attribute

 UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute

 MessageAuthenticationCode ::= OCTET STRING
 
 
 public class AuthenticatedDataParser
 {
     private ASN1SequenceParser seq;
     private ASN1Integer version;
     private ASN1Encodable nextObject;
     private boolean originatorInfoCalled;
 
     public AuthenticatedDataParser(
         ASN1SequenceParser seq)
         throws IOException
     {
         this. = seq;
         this. = ASN1Integer.getInstance(seq.readObject());
     }
 
     public ASN1Integer getVersion()
     {
         return ;
     }
 
     public OriginatorInfo getOriginatorInfo()
         throws IOException
     {
          = true;
 
         if ( == null)
         {
              = .readObject();
         }
 
         if ( instanceof ASN1TaggedObjectParser && ((ASN1TaggedObjectParser)).getTagNo() == 0)
         {
             ASN1SequenceParser originatorInfo = (ASN1SequenceParser) ((ASN1TaggedObjectParser)).getObjectParser(.false);
              = null;
             return OriginatorInfo.getInstance(originatorInfo.toASN1Primitive());
         }
 
         return null;
     }
 
     public ASN1SetParser getRecipientInfos()
         throws IOException
     {
         if (!)
         {
             getOriginatorInfo();
         }
 
         if ( == null)
         {
              = .readObject();
         }
 
         ASN1SetParser recipientInfos = (ASN1SetParser);
          = null;
         return recipientInfos;
     }
 
         throws IOException
     {
         if ( == null)
         {
              = .readObject();
        }
        if ( != null)
        {
            ASN1SequenceParser o = (ASN1SequenceParser);
             = null;
            return AlgorithmIdentifier.getInstance(o.toASN1Primitive());
        }
        return null;
    }
        throws IOException
    {
        if ( == null)
        {
             = .readObject();
        }
        if ( instanceof ASN1TaggedObjectParser)
        {
            AlgorithmIdentifier obj = AlgorithmIdentifier.getInstance((ASN1TaggedObject).toASN1Primitive(), false);
             = null;
            return obj;
        }
        return null;
    }

    

Deprecated:
use getEncapsulatedContentInfo()
        throws IOException
    {
        return getEncapsulatedContentInfo();
    }
        throws IOException
    {
        if ( == null)
        {
             = .readObject();
        }
        if ( != null)
        {
            ASN1SequenceParser o = (ASN1SequenceParser);
             = null;
            return new ContentInfoParser(o);
        }
        return null;
    }
    public ASN1SetParser getAuthAttrs()
        throws IOException
    {
        if ( == null)
        {
             = .readObject();
        }
        if ( instanceof ASN1TaggedObjectParser)
        {
            ASN1Encodable o = ;
             = null;
            return (ASN1SetParser)((ASN1TaggedObjectParser)o).getObjectParser(.false);
        }
        return null;
    }
    public ASN1OctetString getMac()
        throws IOException
    {
        if ( == null)
        {
             = .readObject();
        }
        ASN1Encodable o = ;
         = null;
        return ASN1OctetString.getInstance(o.toASN1Primitive());
    }
    public ASN1SetParser getUnauthAttrs()
        throws IOException
    {
        if ( == null)
        {
             = .readObject();
        }
        if ( != null)
        {
            ASN1Encodable o = ;
             = null;
            return (ASN1SetParser)((ASN1TaggedObjectParser)o).getObjectParser(.false);
        }
        return null;
    }
New to GrepCode? Check out our FAQ X