File: BEID_Certificate.java

package info (click to toggle)
beid 3.5.2.dfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 147,240 kB
  • ctags: 34,507
  • sloc: cpp: 149,944; ansic: 41,577; java: 8,927; cs: 6,528; sh: 2,426; perl: 1,866; xml: 805; python: 463; makefile: 263; lex: 92
file content (198 lines) | stat: -rw-r--r-- 7,573 bytes parent folder | download
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.35
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package be.belgium.eid;

/******************************************************************************//**
  * Class that represent one certificate
  *********************************************************************************/
public class BEID_Certificate extends BEID_Crypto {
  private long swigCPtr;

  protected BEID_Certificate(long cPtr, boolean cMemoryOwn) {
    super(beidlibJava_WrapperJNI.SWIGBEID_CertificateUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  protected static long getCPtr(BEID_Certificate obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      beidlibJava_WrapperJNI.delete_BEID_Certificate(swigCPtr);
    }
    swigCPtr = 0;
    super.delete();
  }

	/** Get the label of the certificate */
  public String getLabel() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_getLabel(swigCPtr, this);
  }

	/** Get the id of the certificate */
  public long getID() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_getID(swigCPtr, this);
  }

	/**
	  * Get the status of the certificate using the default or configured validation level
	  */
  public BEID_CertifStatus getStatus() throws java.lang.Exception {
    return BEID_CertifStatus.swigToEnum(beidlibJava_WrapperJNI.BEID_Certificate_getStatus__SWIG_0(swigCPtr, this));
  }

	/**
	  * Get the status of the certificate
	  * @param crl CRL validation level \see BEID_ValidationLevel
	  * @param ocsp OCSP validation level \see BEID_ValidationLevel
	  */
  public BEID_CertifStatus getStatus(BEID_ValidationLevel crl, BEID_ValidationLevel ocsp) throws java.lang.Exception {
    return BEID_CertifStatus.swigToEnum(beidlibJava_WrapperJNI.BEID_Certificate_getStatus__SWIG_1(swigCPtr, this, crl.swigValue(), ocsp.swigValue()));
  }

	/** Get the type of the certificate */
  public BEID_CertifType getType() throws java.lang.Exception {
    return BEID_CertifType.swigToEnum(beidlibJava_WrapperJNI.BEID_Certificate_getType(swigCPtr, this));
  }

	/** Get the content of the certificate */
  public BEID_ByteArray getCertData() throws java.lang.Exception {
    return new BEID_ByteArray(beidlibJava_WrapperJNI.BEID_Certificate_getCertData(swigCPtr, this), false);
  }

	/** Get the content of the certificate without trailing zero */
  public void getFormattedData(BEID_ByteArray data) {
    beidlibJava_WrapperJNI.BEID_Certificate_getFormattedData(swigCPtr, this, BEID_ByteArray.getCPtr(data), data);
  }

	/** Get the serial number of the certificate */
  public String getSerialNumber() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_getSerialNumber(swigCPtr, this);
  }

	  /** Get the name of the owner of the certificate */
  public String getOwnerName() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_getOwnerName(swigCPtr, this);
  }

	/** Get the name of the issuer of the certificate */
  public String getIssuerName() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_getIssuerName(swigCPtr, this);
  }

	/** Get the validity begin date of the certificate */
  public String getValidityBegin() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_getValidityBegin(swigCPtr, this);
  }

	/** Get the validity end date of the certificate */
  public String getValidityEnd() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_getValidityEnd(swigCPtr, this);
  }

	/** Get the length of public/private key on the certificate */
  public long getKeyLength() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_getKeyLength(swigCPtr, this);
  }

	/**
	  * Check if this is a root certificate;
	  */

  public boolean isRoot() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_isRoot(swigCPtr, this);
  }

	/**
	  * Check if this is a test certificate
	  *
	  * @return true if this is test certificate
	  */
  public boolean isTest() {
    return beidlibJava_WrapperJNI.BEID_Certificate_isTest(swigCPtr, this);
  }

	/**
	  * Return true if the certificate chain ends by the beid root certificate
	  */
  public boolean isFromBeidValidChain() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_isFromBeidValidChain(swigCPtr, this);
  }

	/**
	  * Return true if this certificate comes from the card
	  */
  public boolean isFromCard() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_isFromCard(swigCPtr, this);
  }

	/**
	  * Get the issuer of the certificate
	  *
	  * If there is no issuer (root), BEID_ExCertNoIssuer exception is thrown
	  */
  public BEID_Certificate getIssuer() throws java.lang.Exception {
    return new BEID_Certificate(beidlibJava_WrapperJNI.BEID_Certificate_getIssuer(swigCPtr, this), false);
  }

	/**
	  * Get the number of children of this certificate
	  */
  public long countChildren() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Certificate_countChildren(swigCPtr, this);
  }

	/**
	  * Get a child certificate (certificate that has been issued by this one)
	  *
	  * @param ulIndex is the child index (first child is 0).
	  * Throws BEID_ExParamRange exception if the index is out of range
	  */
  public BEID_Certificate getChildren(long ulIndex) throws java.lang.Exception {
    return new BEID_Certificate(beidlibJava_WrapperJNI.BEID_Certificate_getChildren(swigCPtr, this, ulIndex), false);
  }

	/**
	  * Get the crl of the certificate;
	  */
  public BEID_Crl getCRL() throws java.lang.Exception {
    return new BEID_Crl(beidlibJava_WrapperJNI.BEID_Certificate_getCRL(swigCPtr, this), false);
  }

	/**
	  * Return the ocsp response object of the certificate;
	  */
  public BEID_OcspResponse getOcspResponse() throws java.lang.Exception {
    return new BEID_OcspResponse(beidlibJava_WrapperJNI.BEID_Certificate_getOcspResponse(swigCPtr, this), false);
  }

	/** Verify the certificate trough CRL validation
	  * @param forceDownload if true will force a new download of the CRL, otherwise use the CRL cache
	  */
  public BEID_CertifStatus verifyCRL(boolean forceDownload) throws java.lang.Exception {
    return BEID_CertifStatus.swigToEnum(beidlibJava_WrapperJNI.BEID_Certificate_verifyCRL__SWIG_0(swigCPtr, this, forceDownload));
  }

	/** Verify the certificate trough CRL validation (uses the CRL cache if possible) */
  public BEID_CertifStatus verifyCRL() throws java.lang.Exception {
    return BEID_CertifStatus.swigToEnum(beidlibJava_WrapperJNI.BEID_Certificate_verifyCRL__SWIG_1(swigCPtr, this));
  }

	/** Verify the certificate trough OCSP validation */
  public BEID_CertifStatus verifyOCSP() throws java.lang.Exception {
    return BEID_CertifStatus.swigToEnum(beidlibJava_WrapperJNI.BEID_Certificate_verifyOCSP(swigCPtr, this));
  }

}