diff options
author | David Hook <dgh@cryptoworkshop.com> | 2013-05-31 11:07:45 +0400 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2013-05-31 11:07:45 +0400 |
commit | 2b976f5364cfdbc37d3086019d93483c983eb80b (patch) | |
tree | cb846af3fd1d43f9c2562a1fb2d06b997ad8f229 /core/src/main/java/org/bouncycastle/asn1/dvcs/ServiceType.java | |
parent | 5f714bd92fbd780d22406f4bc3681be005f6f04a (diff) |
initial reshuffle
Diffstat (limited to 'core/src/main/java/org/bouncycastle/asn1/dvcs/ServiceType.java')
-rw-r--r-- | core/src/main/java/org/bouncycastle/asn1/dvcs/ServiceType.java | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/core/src/main/java/org/bouncycastle/asn1/dvcs/ServiceType.java b/core/src/main/java/org/bouncycastle/asn1/dvcs/ServiceType.java new file mode 100644 index 00000000..d6ee94f2 --- /dev/null +++ b/core/src/main/java/org/bouncycastle/asn1/dvcs/ServiceType.java @@ -0,0 +1,92 @@ +package org.bouncycastle.asn1.dvcs; + +import java.math.BigInteger; + +import org.bouncycastle.asn1.ASN1Enumerated; +import org.bouncycastle.asn1.ASN1Object; +import org.bouncycastle.asn1.ASN1Primitive; +import org.bouncycastle.asn1.ASN1TaggedObject; + + +/** + * ServiceType ::= ENUMERATED { cpd(1), vsd(2), cpkc(3), ccpd(4) } + */ + +public class ServiceType + extends ASN1Object +{ + /** + * Identifier of CPD service (Certify Possession of Data). + */ + public static final ServiceType CPD = new ServiceType(1); + + /** + * Identifier of VSD service (Verify Signed Document). + */ + public static final ServiceType VSD = new ServiceType(2); + + /** + * Identifier of VPKC service (Verify Public Key Certificates (also referred to as CPKC)). + */ + public static final ServiceType VPKC = new ServiceType(3); + + /** + * Identifier of CCPD service (Certify Claim of Possession of Data). + */ + public static final ServiceType CCPD = new ServiceType(4); + + private ASN1Enumerated value; + + public ServiceType(int value) + { + this.value = new ASN1Enumerated(value); + } + + private ServiceType(ASN1Enumerated value) + { + this.value = value; + } + + public static ServiceType getInstance(Object obj) + { + if (obj instanceof ServiceType) + { + return (ServiceType)obj; + } + else if (obj != null) + { + return new ServiceType(ASN1Enumerated.getInstance(obj)); + } + + return null; + } + + public static ServiceType getInstance( + ASN1TaggedObject obj, + boolean explicit) + { + return getInstance(ASN1Enumerated.getInstance(obj, explicit)); + } + + public BigInteger getValue() + { + return value.getValue(); + } + + public ASN1Primitive toASN1Primitive() + { + return value; + } + + public String toString() + { + int num = value.getValue().intValue(); + return "" + num + ( + num == CPD.getValue().intValue() ? "(CPD)" : + num == VSD.getValue().intValue() ? "(VSD)" : + num == VPKC.getValue().intValue() ? "(VPKC)" : + num == CCPD.getValue().intValue() ? "(CCPD)" : + "?"); + } + +} |