Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.x509.sigi;
  
  
Contains personal data for the otherName field in the subjectAltNames extension.
     PersonalData ::= SEQUENCE {
       nameOrPseudonym NameOrPseudonym,
       nameDistinguisher [0] INTEGER OPTIONAL,
       dateOfBirth [1] GeneralizedTime OPTIONAL,
       placeOfBirth [2] DirectoryString OPTIONAL,
       gender [3] PrintableString OPTIONAL,
       postalAddress [4] DirectoryString OPTIONAL
       }
 

 
 public class PersonalData
     extends ASN1Object
 {
     private NameOrPseudonym nameOrPseudonym;
     private BigInteger nameDistinguisher;
     private ASN1GeneralizedTime dateOfBirth;
     private DirectoryString placeOfBirth;
     private String gender;
     private DirectoryString postalAddress;
 
     public static PersonalData getInstance(Object obj)
     {
         if (obj == null || obj instanceof PersonalData)
         {
             return (PersonalData)obj;
         }
 
         if (obj instanceof ASN1Sequence)
         {
             return new PersonalData((ASN1Sequence)obj);
         }
 
         throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
     }

    
Constructor from ASN1Sequence.

The sequence is of type NameOrPseudonym:

     PersonalData ::= SEQUENCE {
       nameOrPseudonym NameOrPseudonym,
       nameDistinguisher [0] INTEGER OPTIONAL,
       dateOfBirth [1] GeneralizedTime OPTIONAL,
       placeOfBirth [2] DirectoryString OPTIONAL,
       gender [3] PrintableString OPTIONAL,
       postalAddress [4] DirectoryString OPTIONAL
       }
 

Parameters:
seq The ASN.1 sequence.
 
     private PersonalData(ASN1Sequence seq)
     {
         if (seq.size() < 1)
         {
             throw new IllegalArgumentException("Bad sequence size: "
                 + seq.size());
         }
 
         Enumeration e = seq.getObjects();
 
          = NameOrPseudonym.getInstance(e.nextElement());
 
         while (e.hasMoreElements())
         {
             ASN1TaggedObject o = ASN1TaggedObject.getInstance(e.nextElement());
             int tag = o.getTagNo();
             switch (tag)
             {
                 case 0:
                      = ASN1Integer.getInstance(ofalse).getValue();
                     break;
                 case 1:
                     = ASN1GeneralizedTime.getInstance(ofalse);
                    break;
                case 2:
                     = DirectoryString.getInstance(otrue);
                    break;
                case 3:
                     = DERPrintableString.getInstance(ofalse).getString();
                    break;
                case 4:
                     = DirectoryString.getInstance(otrue);
                    break;
                default:
                    throw new IllegalArgumentException("Bad tag number: " + o.getTagNo());
            }
        }
    }

    
Constructor from a given details.

Parameters:
nameOrPseudonym Name or pseudonym.
nameDistinguisher Name distinguisher.
dateOfBirth Date of birth.
placeOfBirth Place of birth.
gender Gender.
postalAddress Postal Address.
    public PersonalData(NameOrPseudonym nameOrPseudonym,
                        BigInteger nameDistinguisherASN1GeneralizedTime dateOfBirth,
                        DirectoryString placeOfBirthString genderDirectoryString postalAddress)
    {
        this. = nameOrPseudonym;
        this. = dateOfBirth;
        this. = gender;
        this. = nameDistinguisher;
        this. = postalAddress;
        this. = placeOfBirth;
    }
    {
        return ;
    }
    {
        return ;
    }
    {
        return ;
    }
    {
        return ;
    }
    public String getGender()
    {
        return ;
    }
    {
        return ;
    }

    
Produce an object suitable for an ASN1OutputStream.

Returns:

     PersonalData ::= SEQUENCE {
       nameOrPseudonym NameOrPseudonym,
       nameDistinguisher [0] INTEGER OPTIONAL,
       dateOfBirth [1] GeneralizedTime OPTIONAL,
       placeOfBirth [2] DirectoryString OPTIONAL,
       gender [3] PrintableString OPTIONAL,
       postalAddress [4] DirectoryString OPTIONAL
       }
 

Returns:
a DERObject
    {
        ASN1EncodableVector vec = new ASN1EncodableVector();
        vec.add();
        if ( != null)
        {
            vec.add(new DERTaggedObject(false, 0, new ASN1Integer()));
        }
        if ( != null)
        {
            vec.add(new DERTaggedObject(false, 1, ));
        }
        if ( != null)
        {
            vec.add(new DERTaggedObject(true, 2, ));
        }
        if ( != null)
        {
            vec.add(new DERTaggedObject(false, 3, new DERPrintableString(true)));
        }
        if ( != null)
        {
            vec.add(new DERTaggedObject(true, 4, ));
        }
        return new DERSequence(vec);
    }
New to GrepCode? Check out our FAQ X