01: package org.bouncycastle.asn1.esf;
02:
03: import org.bouncycastle.asn1.*;
04:
05: public class SignaturePolicyIdentifier extends ASN1Encodable {
06: private SignaturePolicyId signaturePolicyId;
07: private boolean isSignaturePolicyImplied;
08:
09: public static SignaturePolicyIdentifier getInstance(Object obj) {
10: if (obj == null || obj instanceof SignaturePolicyIdentifier) {
11: return (SignaturePolicyIdentifier) obj;
12: } else if (obj instanceof ASN1Sequence) {
13: return new SignaturePolicyIdentifier(SignaturePolicyId
14: .getInstance(obj));
15: } else if (obj instanceof ASN1Null) {
16: return new SignaturePolicyIdentifier();
17: }
18:
19: throw new IllegalArgumentException(
20: "unknown object in 'SignaturePolicyIdentifier' factory: "
21: + obj.getClass().getName() + ".");
22: }
23:
24: public SignaturePolicyIdentifier() {
25: this .isSignaturePolicyImplied = true;
26: }
27:
28: public SignaturePolicyIdentifier(SignaturePolicyId signaturePolicyId) {
29: this .signaturePolicyId = signaturePolicyId;
30: this .isSignaturePolicyImplied = false;
31: }
32:
33: public SignaturePolicyId getSignaturePolicyId() {
34: return signaturePolicyId;
35: }
36:
37: public boolean isSignaturePolicyImplied() {
38: return isSignaturePolicyImplied;
39: }
40:
41: /**
42: * <pre>
43: * SignaturePolicyIdentifier ::= CHOICE{
44: * SignaturePolicyId SignaturePolicyId,
45: * SignaturePolicyImplied SignaturePolicyImplied }
46: *
47: * SignaturePolicyImplied ::= NULL
48: * </pre>
49: */
50: public DERObject toASN1Object() {
51: if (isSignaturePolicyImplied) {
52: return new DERNull();
53: } else {
54: return signaturePolicyId.getDERObject();
55: }
56: }
57: }
|