Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.cms;
  
RFC 5544: Binding Documents with Time-Stamps; MetaData object.

 MetaData ::= SEQUENCE {
   hashProtected        BOOLEAN,
   fileName             UTF8String OPTIONAL,
   mediaType            IA5String OPTIONAL,
   otherMetaData        Attributes OPTIONAL
 }
 
 
 public class MetaData
     extends ASN1Object
 {
     private ASN1Boolean hashProtected;
     private DERUTF8String fileName;
     private DERIA5String  mediaType;
     private Attributes otherMetaData;
 
     public MetaData(
         ASN1Boolean hashProtected,
         DERUTF8String fileName,
         DERIA5String mediaType,
         Attributes otherMetaData)
     {
         this. = hashProtected;
         this. = fileName;
         this. = mediaType;
         this. = otherMetaData;
     }
 
     private MetaData(ASN1Sequence seq)
     {
         this. = ASN1Boolean.getInstance(seq.getObjectAt(0));
 
         int index = 1;
 
         if (index < seq.size() && seq.getObjectAt(indexinstanceof DERUTF8String)
         {
             this. = DERUTF8String.getInstance(seq.getObjectAt(index++));
         }
         if (index < seq.size() && seq.getObjectAt(indexinstanceof DERIA5String)
         {
             this. = DERIA5String.getInstance(seq.getObjectAt(index++));
         }
         if (index < seq.size())
         {
             this. = Attributes.getInstance(seq.getObjectAt(index++));
         }
     }

    
Return a MetaData object from the given object.

Accepted inputs:

  • null &rarr; null
  • MetaData object
  • ASN1Sequence input formats with MetaData structure inside

Parameters:
obj the object we want converted.
Throws:
java.lang.IllegalArgumentException if the object cannot be converted.
 
     public static MetaData getInstance(Object obj)
     {
         if (obj instanceof MetaData)
         {
             return (MetaData)obj;
         }
         else if (obj != null)
         {
             return new MetaData(ASN1Sequence.getInstance(obj));
         }
 
         return null;
     }
 
     public ASN1Primitive toASN1Primitive()
     {
         ASN1EncodableVector v = new ASN1EncodableVector();
 
         v.add();
 
         if ( != null)
         {
            v.add();
        }
        if ( != null)
        {
            v.add();
        }
        if ( != null)
        {
            v.add();
        }
        
        return new DERSequence(v);
    }
    public boolean isHashProtected()
    {
        return .isTrue();
    }
    public DERUTF8String getFileName()
    {
        return this.;
    }
    public DERIA5String getMediaType()
    {
        return this.;
    }
    public Attributes getOtherMetaData()
    {
        return ;
    }
New to GrepCode? Check out our FAQ X