blob: 2198d1a02632e6e204f1d8282b579c045e178deb (
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
100
101
102
103
104
105
106
107
108
109
|
package org.spongycastle.asn1.ess;
import org.spongycastle.asn1.ASN1EncodableVector;
import org.spongycastle.asn1.ASN1Object;
import org.spongycastle.asn1.ASN1Primitive;
import org.spongycastle.asn1.ASN1Sequence;
import org.spongycastle.asn1.DERSequence;
import org.spongycastle.asn1.x509.PolicyInformation;
public class OtherSigningCertificate
extends ASN1Object
{
ASN1Sequence certs;
ASN1Sequence policies;
public static OtherSigningCertificate getInstance(Object o)
{
if (o instanceof OtherSigningCertificate)
{
return (OtherSigningCertificate) o;
}
else if (o != null)
{
return new OtherSigningCertificate(ASN1Sequence.getInstance(o));
}
return null;
}
/**
* constructeurs
*/
private OtherSigningCertificate(ASN1Sequence seq)
{
if (seq.size() < 1 || seq.size() > 2)
{
throw new IllegalArgumentException("Bad sequence size: "
+ seq.size());
}
this.certs = ASN1Sequence.getInstance(seq.getObjectAt(0));
if (seq.size() > 1)
{
this.policies = ASN1Sequence.getInstance(seq.getObjectAt(1));
}
}
public OtherSigningCertificate(
OtherCertID otherCertID)
{
certs = new DERSequence(otherCertID);
}
public OtherCertID[] getCerts()
{
OtherCertID[] cs = new OtherCertID[certs.size()];
for (int i = 0; i != certs.size(); i++)
{
cs[i] = OtherCertID.getInstance(certs.getObjectAt(i));
}
return cs;
}
public PolicyInformation[] getPolicies()
{
if (policies == null)
{
return null;
}
PolicyInformation[] ps = new PolicyInformation[policies.size()];
for (int i = 0; i != policies.size(); i++)
{
ps[i] = PolicyInformation.getInstance(policies.getObjectAt(i));
}
return ps;
}
/**
* The definition of OtherSigningCertificate is
* <pre>
* OtherSigningCertificate ::= SEQUENCE {
* certs SEQUENCE OF OtherCertID,
* policies SEQUENCE OF PolicyInformation OPTIONAL
* }
* </pre>
* id-aa-ets-otherSigCert OBJECT IDENTIFIER ::= { iso(1)
* member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
* smime(16) id-aa(2) 19 }
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(certs);
if (policies != null)
{
v.add(policies);
}
return new DERSequence(v);
}
}
|