package SecureDongle;

import com.sun.jna.Library;
import com.sun.jna.Native;

public interface LibSecureDongle extends Library {
    LibSecureDongle Instance = (LibSecureDongle) Native.load("SecureDongleJ", LibSecureDongle.class);
    short SD_FIND=1;
    short SD_FIND_NEXT=2;
    short SD_OPEN=3;
    short SD_CLOSE=4;
    short SD_READ=5;
    short SD_WRITE=6;
    short SD_RANDOM=7;
    short SD_SEED=8;
    short SD_WRITE_USERID=9;
    short SD_READ_USERID=10;
    short SD_SET_MODULE=11;
    short SD_CHECK_MODULE=12;
    short SD_WRITE_ARITHMETIC=13;
    short SD_CALCULATE1=14;
    short SD_CALCULATE2=15;
    short SD_CALCULATE3=16;
    short SD_DECREASE=17;

    short SD_SET_RSAKEY_N=29;
    short SD_SET_RSAKEY_D=30;

    short SD_SET_DES_KEY=41;
    short SD_DES_ENC=42;
    short SD_DES_DEC=43;
    short SD_RSA_ENC=44;
    short SD_RSA_DEC=45;

    short SD_READ_EX=46;
    short SD_WRITE_EX=47;

    short SD_SET_COUNTER_EX=160;
    short SD_GET_COUNTER_EX=161;
    short SD_SET_TIMER_EX=162;
    short SD_GET_TIMER_EX=163;
    short SD_ADJUST_TIMER_EX=164;
    short SD_UPDATE_GEN_HEADER_EX=165;
    short SD_UPDATE_GEN_EX=166;
    short SD_UPDATE_CHECK_EX=167;
    short SD_UPDATE_EX=168;
    short SD_SET_UPDATE_KEY=169;
    short SD_ADD_UPDATE_HEADER=170;
    short SD_ADD_UPDATE_CONTENT=171;
    short SD_GET_TIME_DWORD=172;

    short SD_VERSION=100;

    short DES_SINGLE_MODE=0;
    short DES_TRIPLE_MODE=1;
    short RSA_PRIVATE_KEY=0;
    short RSA_PUBLIC_KEY=1;
    short RSA_SECUREDONGLE_PADDING=0;
    short RSA_USER_PADDING=1;

    //error code
    short ERR_SUCCESS=0;
    short ERR_NO_ROCKEY=3;
    short ERR_INVALID_PASSWORD=4;
    short ERR_INVALID_PASSWORD_OR_ID=5;
    short ERR_SETID=6;
    short ERR_INVALID_ADDR_OR_SIZE=7;
    short ERR_UNKNOWN_COMMAND=8;
    short ERR_NOTBELEVEL3=9;
    short ERR_READ=10;
    short ERR_WRITE=11;
    short ERR_RANDOM=12;
    short ERR_SEED=13;
    short ERR_CALCULATE=14;
    short ERR_NO_OPEN=15;
    short ERR_OPEN_OVERFLOW=16;
    short ERR_NOMORE=17;
    short ERR_NEED_FIND=18;
    short ERR_DECREASE=19;
    short ERR_AR_BADCOMMAND=20;
    short ERR_AR_UNKNOWN_OPCODE=21;
    short ERR_AR_WRONGBEGIN=22;
    short ERR_AR_WRONG_END=23;
    short ERR_AR_VALUEOVERFLOW=24;

    short ERR_TOOMUCHTHREAD=25;
    short ERR_INVALID_SD=30;
    short ERR_INVALID_PARAMETER=31;
    short ERR_INVALID_TIMEVALUE=32;

    short ERR_SET_DES_KEY=40;
    short ERR_DES_ENCRYPT=41;
    short ERR_DES_DECRYPT=42;
    short ERR_SET_RSAKEY_N=43;
    short ERR_SET_RSAKEY_D=44;
    short ERR_RSA_ENCRYPT=45;
    short ERR_RSA_DECRYPT=46;
    short ERR_INVALID_LENGTH=47;

    short ERR_UNKNOWN=-1;
    short ERR_RECEIVE_NULL=256;
    short ERR_INVALID_BUFFER=257;
    short ERR_UNKNOWN_SYSTEM=258;
    short ERR_UNINIT_TIME_UNIT=259;

    short SecureDongle(short command, short[] handle, int[] lp1, int[] lp2, short[] p1, short[] p2, short[] p3, short[] p4, byte[] buffer);
}
