1 17 18 package org.apache.geronimo.util.asn1.x509; 19 20 import org.apache.geronimo.util.asn1.ASN1Encodable; 21 import org.apache.geronimo.util.asn1.ASN1EncodableVector; 22 import org.apache.geronimo.util.asn1.ASN1Sequence; 23 import org.apache.geronimo.util.asn1.DERObject; 24 import org.apache.geronimo.util.asn1.DERSequence; 25 26 40 public class UserNotice 41 extends ASN1Encodable 42 { 43 NoticeReference noticeRef; 44 DisplayText explicitText; 45 46 52 public UserNotice( 53 NoticeReference noticeRef, 54 DisplayText explicitText) 55 { 56 this.noticeRef = noticeRef; 57 this.explicitText = explicitText; 58 } 59 60 66 public UserNotice( 67 NoticeReference noticeRef, 68 String str) 69 { 70 this.noticeRef = noticeRef; 71 this.explicitText = new DisplayText(str); 72 } 73 74 83 public UserNotice( 84 ASN1Sequence as) 85 { 86 if (as.size() == 2) 87 { 88 noticeRef = NoticeReference.getInstance(as.getObjectAt(0)); 89 explicitText = DisplayText.getInstance(as.getObjectAt(1)); 90 } 91 else if (as.size() == 1) 92 { 93 if (as.getObjectAt(0).getDERObject() instanceof ASN1Sequence) 94 { 95 noticeRef = NoticeReference.getInstance(as.getObjectAt(0)); 96 } 97 else 98 { 99 explicitText = DisplayText.getInstance(as.getObjectAt(0)); 100 } 101 } 102 } 103 104 public DERObject toASN1Object() 105 { 106 ASN1EncodableVector av = new ASN1EncodableVector(); 107 108 if (noticeRef != null) 109 { 110 av.add(noticeRef); 111 } 112 113 if (explicitText != null) 114 { 115 av.add(explicitText); 116 } 117 118 return new DERSequence(av); 119 } 120 } 121 | Popular Tags |