All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xbib.asn1.ASN1PrintableString Maven / Gradle / Ivy

package org.xbib.asn1;

/**
 * Representation for ASN.1 PrintableString.
 * The PrintableString type denotes an arbitary string
 * of printable characters from the following character set:
 * 
 *     
 * 
Printable Strings
Capital lettersA, B, ... , Z *
Small lettersa, b, ..., z *
Digits0, 1, ..., 9 *
Space *
Apostrophe' *
Left partnthesis( *
Right partnthesis) *
Plus+ *
comma, *
hyphen- *
Full stop. *
Solidus/ *
Colon: *
Equal sign= *
Question mark? *
* This type is a string type. */ public final class ASN1PrintableString extends ASN1OctetString { /** * This constant is the ASN.1 UNIVERSAL tag value for PrintableString. */ public static final int PRINTABLE_STRING_TAG = 0x13; /** * Constructor for a PrintableString object. It sets the tag to the * default value of UNIVERSAL 19 (0x13). * @param text text */ public ASN1PrintableString(String text) { super(text); } /** * Constructor for a PrintableString object from a primitive BER encoding. * * @param ber The BER encoding to use. * @param checkTag If true, it checks the tag. Use false if is implicitly tagged. * @throws ASN1Exception If the BER encoding is incorrect. */ public ASN1PrintableString(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); if (checkTag && (ber.tagGet() != PRINTABLE_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { throw new ASN1EncodingException("ASN.1 PrintableString: bad BER: tag=" + ber.tagGet() + " expected " + PRINTABLE_STRING_TAG + "\n"); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy