1
10package org.jstk.asn1;
11
12public class ASN1IA5String extends ASN1Type {
13 private static char[] hexChars =
14 { '0', '1', '2', '3', '4', '5', '6', '7',
15 '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
16 public ASN1IA5String(){
17 super(UNIVERSAL, NONE, IA5String, IA5String);
18 }
19 public byte[] getValue(){
20 return value;
21 }
22 public void setValue(byte[] value){
23 this.value = value;
24 }
25 public String getString(){
26 return new String(value);
27 }
28 public void setString(String s){
29 this.value = s.getBytes();
30 }
31 public String toString(){
32 if (value == null)
33 return null;
34 return "IA5String: " + new String(value);
35 }
36
37 public static void main(String[] args){
38 byte[] bytes = { 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, 0x73, 0x65, 0x72, 0x20, 0x31 };
39 ASN1IA5String ps = new ASN1IA5String();
40 ps.setValue(bytes);
41 System.out.println(ps.toString());
42 }
43}