File: BEID_Pin.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 (122 lines) | stat: -rw-r--r-- 4,320 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
/* ----------------------------------------------------------------------------
 * 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 represents one Pin
  *********************************************************************************/
public class BEID_Pin extends BEID_Crypto {
  private long swigCPtr;

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

  protected static long getCPtr(BEID_Pin 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_Pin(swigCPtr);
    }
    swigCPtr = 0;
    super.delete();
  }

	/** Get the index of the pin */
  public long getIndex() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Pin_getIndex(swigCPtr, this);
  }

	/** Get the type of the pin */
  public long getType() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Pin_getType(swigCPtr, this);
  }

	/** Get the id of the pin */
  public long getId() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Pin_getId(swigCPtr, this);
  }

	/** Get the usage code of the pin */
  public BEID_PinUsage getUsageCode() throws java.lang.Exception {
    return BEID_PinUsage.swigToEnum(beidlibJava_WrapperJNI.BEID_Pin_getUsageCode(swigCPtr, this));
  }

	/** Get the flags of the pin */
  public long getFlags() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Pin_getFlags(swigCPtr, this);
  }

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

	/** Return the signature of the pin */
  public BEID_ByteArray getSignature() throws java.lang.Exception {
    return new BEID_ByteArray(beidlibJava_WrapperJNI.BEID_Pin_getSignature(swigCPtr, this), false);
  }

	/**
	  * Return the remaining tries
	  *
	  * This opperation is not supported by all cards.
	  *
	  * @return -1 if not supported, else the number of remaining tries
	  */
  public int getTriesLeft() throws java.lang.Exception {
    return beidlibJava_WrapperJNI.BEID_Pin_getTriesLeft(swigCPtr, this);
  }

	/**
	  * Ask the card to verify the pin
	  *
	  * @param csPin is the pin code to verify (if csPin is empty, a popup will ask for the code)
	  * @param ulRemaining return the remaining tries (only if verifying failed)
	  *
	  * @return true if success and false if failed
	  */
  public boolean verifyPin(String csPin, BEID_ulwrapper ulRemaining) throws java.lang.Exception {
	  long		pRemaining = beidlibJava_WrapperJNI.new_ulongp();				// get a C++ ptr
	  boolean	retval     = beidlibJava_WrapperJNI.BEID_Pin_verifyPin(swigCPtr, this, csPin, pRemaining);

	  ulRemaining.m_long = beidlibJava_WrapperJNI.ulongp_value(pRemaining);
	  beidlibJava_WrapperJNI.delete_ulongp(pRemaining);
	  return retval;
}

	/**
	  * Ask the card to change the pin
	  *
	  * if csPin1 or csPin2 are empty, a popup will ask for the codes
	  *
	  * @param csPin1 is the old pin code
	  * @param csPin2 is the new pin code
	  * @param ulRemaining return the remaining tries (only when operation failed)
	  *
	  * @return true if success and false if failed
	  */
  public boolean changePin(String csPin1, String csPin2, BEID_ulwrapper ulRemaining) throws java.lang.Exception {
	  long		pRemaining	= beidlibJava_WrapperJNI.new_ulongp();				// get a C++ ptr
	  boolean	retval		= beidlibJava_WrapperJNI.BEID_Pin_changePin(swigCPtr, this, csPin1, csPin2, pRemaining);

	  ulRemaining.m_long = beidlibJava_WrapperJNI.ulongp_value(pRemaining);
	  beidlibJava_WrapperJNI.delete_ulongp(pRemaining);
	  return retval;
}

}