Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.x509.sigi;
  
  
Structure for a name or pseudonym.
       NameOrPseudonym ::= CHOICE {
            surAndGivenName SEQUENCE {
              surName DirectoryString,
              givenName SEQUENCE OF DirectoryString 
         },
            pseudonym DirectoryString 
       }
 

See also:
PersonalData
 
 public class NameOrPseudonym
     extends ASN1Object
     implements ASN1Choice
 {
     private DirectoryString pseudonym;
 
     private DirectoryString surname;
 
     private ASN1Sequence givenName;
 
     public static NameOrPseudonym getInstance(Object obj)
     {
         if (obj == null || obj instanceof NameOrPseudonym)
         {
             return (NameOrPseudonym)obj;
         }
 
         if (obj instanceof ASN1String)
         {
             return new NameOrPseudonym(DirectoryString.getInstance(obj));
         }
 
         if (obj instanceof ASN1Sequence)
         {
             return new NameOrPseudonym((ASN1Sequence)obj);
         }
 
         throw new IllegalArgumentException("illegal object in getInstance: "
             + obj.getClass().getName());
     }

    
Constructor from DirectoryString.

The sequence is of type NameOrPseudonym:

       NameOrPseudonym ::= CHOICE {
            surAndGivenName SEQUENCE {
              surName DirectoryString,
              givenName SEQUENCE OF DirectoryString
         },
            pseudonym DirectoryString
       }
 

Parameters:
pseudonym pseudonym value to use.
 
     public NameOrPseudonym(DirectoryString pseudonym)
     {
         this. = pseudonym;
     }

    
Constructor from ASN1Sequence.

The sequence is of type NameOrPseudonym:

       NameOrPseudonym ::= CHOICE {
            surAndGivenName SEQUENCE {
              surName DirectoryString,
              givenName SEQUENCE OF DirectoryString
         },
            pseudonym DirectoryString
       }
 

Parameters:
seq The ASN.1 sequence.
 
     private NameOrPseudonym(ASN1Sequence seq)
     {
         if (seq.size() != 2)
        {
            throw new IllegalArgumentException("Bad sequence size: "
                + seq.size());
        }
        if (!(seq.getObjectAt(0) instanceof ASN1String))
        {
            throw new IllegalArgumentException("Bad object encountered: "
                + seq.getObjectAt(0).getClass());
        }
         = DirectoryString.getInstance(seq.getObjectAt(0));
         = ASN1Sequence.getInstance(seq.getObjectAt(1));
    }

    
Constructor from a given details.

Parameters:
pseudonym The pseudonym.
    public NameOrPseudonym(String pseudonym)
    {
        this(new DirectoryString(pseudonym));
    }

    
Constructor from a given details.

Parameters:
surname The surname.
givenName A sequence of directory strings making up the givenName
    public NameOrPseudonym(DirectoryString surnameASN1Sequence givenName)
    {
        this. = surname;
        this. = givenName;
    }
    public DirectoryString getPseudonym()
    {
        return ;
    }
    public DirectoryString getSurname()
    {
        return ;
    }
    public DirectoryString[] getGivenName()
    {
        DirectoryString[] items = new DirectoryString[.size()];
        int count = 0;
        for (Enumeration e = .getObjects(); e.hasMoreElements();)
        {
            items[count++] = DirectoryString.getInstance(e.nextElement());
        }
        return items;
    }

    
Produce an object suitable for an ASN1OutputStream.

Returns:

       NameOrPseudonym ::= CHOICE {
            surAndGivenName SEQUENCE {
              surName DirectoryString,
              givenName SEQUENCE OF DirectoryString
         },
            pseudonym DirectoryString
       }
 

Returns:
a DERObject
    {
        if ( != null)
        {
            return .toASN1Primitive();
        }
        else
        {
            ASN1EncodableVector vec1 = new ASN1EncodableVector();
            vec1.add();
            vec1.add();
            return new DERSequence(vec1);
        }
    }
New to GrepCode? Check out our FAQ X