Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.bouncycastle.asn1.cms;
 
RFC 5652 defines 5 "SET OF Attribute" entities with 5 different names. This is common implementation for them all:
   SignedAttributes      ::= SET SIZE (1..MAX) OF Attribute
   UnsignedAttributes    ::= SET SIZE (1..MAX) OF Attribute
   UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute
   AuthAttributes        ::= SET SIZE (1..MAX) OF Attribute
   UnauthAttributes      ::= SET SIZE (1..MAX) OF Attribute

 Attributes ::=
   SET SIZE(1..MAX) OF Attribute
 
public class Attributes
    extends ASN1Object
    private ASN1Set attributes;
    private Attributes(ASN1Set set)
    {
         = set;
    }
    public Attributes(ASN1EncodableVector v)
    {
         = new DLSet(v);
    }

    
Return an Attribute set object from the given object.

Accepted inputs:

  • null → null
  • Attributes object
  • ASN1Set input formats with Attributes structure inside

Parameters:
obj the object we want converted.
Throws:
java.lang.IllegalArgumentException if the object cannot be converted.
    public static Attributes getInstance(Object obj)
    {
        if (obj instanceof Attributes)
        {
            return (Attributes)obj;
        }
        else if (obj != null)
        {
            return new Attributes(ASN1Set.getInstance(obj));
        }
        return null;
    }
    public Attribute[] getAttributes()
    {
        Attribute[] rv = new Attribute[.size()];
        for (int i = 0; i != rv.lengthi++)
        {
            rv[i] = Attribute.getInstance(.getObjectAt(i));
        }
        return rv;
    }

    
Produce an object suitable for an ASN1OutputStream.
    public ASN1Primitive toASN1Primitive()
    {
        return ;
    }
New to GrepCode? Check out our FAQ X