blob: 759227fdeeed0dbdb4d8595303c703279c1e23ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
package org.spongycastle.asn1.esf;
import java.util.Enumeration;
import org.spongycastle.asn1.ASN1Encodable;
import org.spongycastle.asn1.ASN1EncodableVector;
import org.spongycastle.asn1.ASN1Object;
import org.spongycastle.asn1.ASN1Primitive;
import org.spongycastle.asn1.ASN1Sequence;
import org.spongycastle.asn1.ASN1String;
import org.spongycastle.asn1.DERSequence;
import org.spongycastle.asn1.x509.DisplayText;
import org.spongycastle.asn1.x509.NoticeReference;
public class SPUserNotice
extends ASN1Object
{
private NoticeReference noticeRef;
private DisplayText explicitText;
public static SPUserNotice getInstance(
Object obj)
{
if (obj instanceof SPUserNotice)
{
return (SPUserNotice)obj;
}
else if (obj != null)
{
return new SPUserNotice(ASN1Sequence.getInstance(obj));
}
return null;
}
private SPUserNotice(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
while (e.hasMoreElements())
{
ASN1Encodable object = (ASN1Encodable)e.nextElement();
if (object instanceof DisplayText || object instanceof ASN1String)
{
explicitText = DisplayText.getInstance(object);
}
else if (object instanceof NoticeReference || object instanceof ASN1Sequence)
{
noticeRef = NoticeReference.getInstance(object);
}
else
{
throw new IllegalArgumentException("Invalid element in 'SPUserNotice': " + object.getClass().getName());
}
}
}
public SPUserNotice(
NoticeReference noticeRef,
DisplayText explicitText)
{
this.noticeRef = noticeRef;
this.explicitText = explicitText;
}
public NoticeReference getNoticeRef()
{
return noticeRef;
}
public DisplayText getExplicitText()
{
return explicitText;
}
/**
* <pre>
* SPUserNotice ::= SEQUENCE {
* noticeRef NoticeReference OPTIONAL,
* explicitText DisplayText OPTIONAL }
* </pre>
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
if (noticeRef != null)
{
v.add(noticeRef);
}
if (explicitText != null)
{
v.add(explicitText);
}
return new DERSequence(v);
}
}
|