FileDocCategorySizeDatePackage
DisplayText.javaAPI DocAzureus 3.0.3.44167Tue Jun 08 05:12:56 BST 2004org.bouncycastle.asn1.x509

DisplayText

public class DisplayText extends org.bouncycastle.asn1.ASN1Encodable
DisplayText class, used in CertificatePolicies X509 V3 extensions (in policy qualifiers).

It stores a string in a chosen encoding.

DisplayText ::= CHOICE {
ia5String IA5String (SIZE (1..200)),
visibleString VisibleString (SIZE (1..200)),
bmpString BMPString (SIZE (1..200)),
utf8String UTF8String (SIZE (1..200)) }
see
PolicyQualifierInfo
see
PolicyInformation

Fields Summary
public static final int
CONTENT_TYPE_IA5STRING
Constant corresponding to ia5String encoding.
public static final int
CONTENT_TYPE_BMPSTRING
Constant corresponding to bmpString encoding.
public static final int
CONTENT_TYPE_UTF8STRING
Constant corresponding to utf8String encoding.
public static final int
CONTENT_TYPE_VISIBLESTRING
Constant corresponding to visibleString encoding.
public static final int
DISPLAY_TEXT_MAXIMUM_SIZE
Describe constant DISPLAY_TEXT_MAXIMUM_SIZE here.
int
contentType
org.bouncycastle.asn1.DERString
contents
Constructors Summary
public DisplayText(int type, String text)
Creates a new DisplayText instance.

param
type the desired encoding type for the text.
param
text the text to store. Strings longer than 200 characters are truncated.

   
                                    
         
   
      if (text.length() > DISPLAY_TEXT_MAXIMUM_SIZE) {
         // RFC3280 limits these strings to 200 chars
         // truncate the string
         text = text.substring (0, DISPLAY_TEXT_MAXIMUM_SIZE);
      }
     
      contentType = type;
      switch (type) {
         case CONTENT_TYPE_IA5STRING:
            contents = (DERString)new DERIA5String (text);
            break;
         case CONTENT_TYPE_UTF8STRING:
            contents = (DERString)new DERUTF8String(text);
            break;
         case CONTENT_TYPE_VISIBLESTRING:
            contents = (DERString)new DERVisibleString(text);
            break;
         case CONTENT_TYPE_BMPSTRING:
            contents = (DERString)new DERBMPString(text);
            break;
         default:
            contents = (DERString)new DERUTF8String(text);
            break;
      }
   
public DisplayText(String text)
Creates a new DisplayText instance.

param
text the text to encapsulate. Strings longer than 200 characters are truncated.

      // by default use UTF8String
      if (text.length() > DISPLAY_TEXT_MAXIMUM_SIZE) {
         text = text.substring(0, DISPLAY_TEXT_MAXIMUM_SIZE);
      }
      
      contentType = CONTENT_TYPE_UTF8STRING;
      contents = new DERUTF8String(text);
   
public DisplayText(org.bouncycastle.asn1.DERString de)
Creates a new DisplayText instance.

Useful when reading back a DisplayText class from it's ASN1Encodable/DEREncodable form.

param
de a DEREncodable instance.

      contents = de;
   
Methods Summary
public static org.bouncycastle.asn1.x509.DisplayTextgetInstance(java.lang.Object de)

      if (de instanceof DERString)
      {
          return new DisplayText((DERString)de);
      }
      else if (de instanceof DisplayText)
      {
          return (DisplayText)de;
      }

      throw new IllegalArgumentException("illegal object in getInstance");
   
public java.lang.StringgetString()
Returns the stored String object.

return
the stored text as a String.

      return contents.getString();
   
public org.bouncycastle.asn1.DERObjecttoASN1Object()

      return (DERObject)contents;