Sleds/libeye/java/com/sequencelogic/Key.java

356 lines
17 KiB
Java

/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.8
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.sequencelogic;
public class Key {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected Key(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(Key obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
eyeinterfaceJNI.delete_Key(swigCPtr);
}
swigCPtr = 0;
}
}
public Key(String name, String desc, long len, SWIGTYPE_p_unsigned_char key, Key.KEY_TYPE type) {
this(eyeinterfaceJNI.new_Key__SWIG_0(name, desc, len, SWIGTYPE_p_unsigned_char.getCPtr(key), type.swigValue()), true);
}
public Key(String name, String desc, String key, Key.KEY_TYPE type) {
this(eyeinterfaceJNI.new_Key__SWIG_1(name, desc, key, type.swigValue()), true);
}
public Key(String name, String desc, String filename, String password) {
this(eyeinterfaceJNI.new_Key__SWIG_2(name, desc, filename, password), true);
}
public Key(String filename, String password) {
this(eyeinterfaceJNI.new_Key__SWIG_3(filename, password), true);
}
public Key() {
this(eyeinterfaceJNI.new_Key__SWIG_4(), true);
}
public boolean IsValid() {
return eyeinterfaceJNI.Key_IsValid(swigCPtr, this);
}
public SWIGTYPE_p_unsigned_char SymmetricDecryptBuffer(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen, SWIGTYPE_p_unsigned_char iv) {
long cPtr = eyeinterfaceJNI.Key_SymmetricDecryptBuffer(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen), SWIGTYPE_p_unsigned_char.getCPtr(iv));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char SymmetricEncryptBuffer(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen, SWIGTYPE_p_unsigned_char iv) {
long cPtr = eyeinterfaceJNI.Key_SymmetricEncryptBuffer(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen), SWIGTYPE_p_unsigned_char.getCPtr(iv));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public boolean SymmetricEncryptFile(String plainfile, String encryptedfile, SWIGTYPE_p_unsigned_char iv) {
return eyeinterfaceJNI.Key_SymmetricEncryptFile(swigCPtr, this, plainfile, encryptedfile, SWIGTYPE_p_unsigned_char.getCPtr(iv));
}
public boolean SymmetricDecryptFile(String encryptedfile, String plainfile, SWIGTYPE_p_unsigned_char iv) {
return eyeinterfaceJNI.Key_SymmetricDecryptFile(swigCPtr, this, encryptedfile, plainfile, SWIGTYPE_p_unsigned_char.getCPtr(iv));
}
public SWIGTYPE_p_unsigned_char SymmetricEncryptAuthenticated(SWIGTYPE_p_unsigned_char plaintext, long inlen, SWIGTYPE_p_size_t outlen, SWIGTYPE_p_unsigned_char iv, SWIGTYPE_p_unsigned_char aad, long aadlen) {
long cPtr = eyeinterfaceJNI.Key_SymmetricEncryptAuthenticated__SWIG_0(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(plaintext), inlen, SWIGTYPE_p_size_t.getCPtr(outlen), SWIGTYPE_p_unsigned_char.getCPtr(iv), SWIGTYPE_p_unsigned_char.getCPtr(aad), aadlen);
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char SymmetricEncryptAuthenticated(SWIGTYPE_p_unsigned_char plaintext, long inlen, SWIGTYPE_p_size_t outlen, SWIGTYPE_p_unsigned_char iv, SWIGTYPE_p_unsigned_char aad) {
long cPtr = eyeinterfaceJNI.Key_SymmetricEncryptAuthenticated__SWIG_1(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(plaintext), inlen, SWIGTYPE_p_size_t.getCPtr(outlen), SWIGTYPE_p_unsigned_char.getCPtr(iv), SWIGTYPE_p_unsigned_char.getCPtr(aad));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char SymmetricEncryptAuthenticated(SWIGTYPE_p_unsigned_char plaintext, long inlen, SWIGTYPE_p_size_t outlen, SWIGTYPE_p_unsigned_char iv) {
long cPtr = eyeinterfaceJNI.Key_SymmetricEncryptAuthenticated__SWIG_2(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(plaintext), inlen, SWIGTYPE_p_size_t.getCPtr(outlen), SWIGTYPE_p_unsigned_char.getCPtr(iv));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char SymmetricDecryptAuthenticated(SWIGTYPE_p_unsigned_char ciphertext, long inlen, SWIGTYPE_p_size_t outlen, SWIGTYPE_p_unsigned_char iv, SWIGTYPE_p_unsigned_char aad, long aadlen) {
long cPtr = eyeinterfaceJNI.Key_SymmetricDecryptAuthenticated__SWIG_0(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(ciphertext), inlen, SWIGTYPE_p_size_t.getCPtr(outlen), SWIGTYPE_p_unsigned_char.getCPtr(iv), SWIGTYPE_p_unsigned_char.getCPtr(aad), aadlen);
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char SymmetricDecryptAuthenticated(SWIGTYPE_p_unsigned_char ciphertext, long inlen, SWIGTYPE_p_size_t outlen, SWIGTYPE_p_unsigned_char iv, SWIGTYPE_p_unsigned_char aad) {
long cPtr = eyeinterfaceJNI.Key_SymmetricDecryptAuthenticated__SWIG_1(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(ciphertext), inlen, SWIGTYPE_p_size_t.getCPtr(outlen), SWIGTYPE_p_unsigned_char.getCPtr(iv), SWIGTYPE_p_unsigned_char.getCPtr(aad));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char SymmetricDecryptAuthenticated(SWIGTYPE_p_unsigned_char ciphertext, long inlen, SWIGTYPE_p_size_t outlen, SWIGTYPE_p_unsigned_char iv) {
long cPtr = eyeinterfaceJNI.Key_SymmetricDecryptAuthenticated__SWIG_2(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(ciphertext), inlen, SWIGTYPE_p_size_t.getCPtr(outlen), SWIGTYPE_p_unsigned_char.getCPtr(iv));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char HMACEncrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_HMACEncrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char HMACDecrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_HMACDecrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char PublicKeyEncrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_PublicKeyEncrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char PrivateKeyDecrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_PrivateKeyDecrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char PrivateKeySign(SWIGTYPE_p_unsigned_char tbs, long tbslen, SWIGTYPE_p_size_t siglen) {
long cPtr = eyeinterfaceJNI.Key_PrivateKeySign(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(tbs), tbslen, SWIGTYPE_p_size_t.getCPtr(siglen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public int PublicKeyVerify(SWIGTYPE_p_unsigned_char sig, long siglen, SWIGTYPE_p_unsigned_char tbs, long tbslen) {
return eyeinterfaceJNI.Key_PublicKeyVerify(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(sig), siglen, SWIGTYPE_p_unsigned_char.getCPtr(tbs), tbslen);
}
public SWIGTYPE_p_unsigned_char RSAPrivateKeyEncrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_RSAPrivateKeyEncrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char RSAPublicKeyDecrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_RSAPublicKeyDecrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char ECIESEncrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_ECIESEncrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char ECIESDecrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_ECIESDecrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char RSAIESEncrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_RSAIESEncrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char RSAIESDecrypt(SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_RSAIESDecrypt(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char ECDHEncrypt(Key peer, SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_ECDHEncrypt(swigCPtr, this, Key.getCPtr(peer), peer, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char ECDHDecrypt(Key peer, SWIGTYPE_p_unsigned_char in, long inlen, SWIGTYPE_p_size_t outlen) {
long cPtr = eyeinterfaceJNI.Key_ECDHDecrypt(swigCPtr, this, Key.getCPtr(peer), peer, SWIGTYPE_p_unsigned_char.getCPtr(in), inlen, SWIGTYPE_p_size_t.getCPtr(outlen));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char GenerateECDHSecret(Key peer, SWIGTYPE_p_size_t secret_len) {
long cPtr = eyeinterfaceJNI.Key_GenerateECDHSecret(swigCPtr, this, Key.getCPtr(peer), peer, SWIGTYPE_p_size_t.getCPtr(secret_len));
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public String GetPubKey() {
return eyeinterfaceJNI.Key_GetPubKey(swigCPtr, this);
}
public String PublicKeyFingerPrint() {
return eyeinterfaceJNI.Key_PublicKeyFingerPrint(swigCPtr, this);
}
public boolean Export(String filename, String password) {
return eyeinterfaceJNI.Key_Export(swigCPtr, this, filename, password);
}
public boolean Import(String filename, String password) {
return eyeinterfaceJNI.Key_Import__SWIG_0(swigCPtr, this, filename, password);
}
public boolean Import(String buffer, long bytes, String password, Key.KEY_FORMAT format) {
return eyeinterfaceJNI.Key_Import__SWIG_1(swigCPtr, this, buffer, bytes, password, format.swigValue());
}
public void Duplicate(Key dupkey) {
eyeinterfaceJNI.Key_Duplicate(swigCPtr, this, Key.getCPtr(dupkey), dupkey);
}
public void SetType(Key.KEY_TYPE type) {
eyeinterfaceJNI.Key_SetType(swigCPtr, this, type.swigValue());
}
public void SetKey(SWIGTYPE_p_unsigned_char key, long bytes) {
eyeinterfaceJNI.Key_SetKey(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(key), bytes);
}
public void SetIv(SWIGTYPE_p_unsigned_char iv, long bytes) {
eyeinterfaceJNI.Key_SetIv(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(iv), bytes);
}
public String GetName() {
return eyeinterfaceJNI.Key_GetName(swigCPtr, this);
}
public String GetDescription() {
return eyeinterfaceJNI.Key_GetDescription(swigCPtr, this);
}
public long GetLength() {
return eyeinterfaceJNI.Key_GetLength(swigCPtr, this);
}
public SWIGTYPE_p_unsigned_char GetKey() {
long cPtr = eyeinterfaceJNI.Key_GetKey(swigCPtr, this);
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public SWIGTYPE_p_unsigned_char GetIv() {
long cPtr = eyeinterfaceJNI.Key_GetIv(swigCPtr, this);
return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
}
public Key.KEY_TYPE GetType() {
return Key.KEY_TYPE.swigToEnum(eyeinterfaceJNI.Key_GetType(swigCPtr, this));
}
public String GetStringKey() {
return eyeinterfaceJNI.Key_GetStringKey(swigCPtr, this);
}
public boolean Equals(Key other) {
return eyeinterfaceJNI.Key_Equals(swigCPtr, this, Key.getCPtr(other), other);
}
public void Dump() {
eyeinterfaceJNI.Key_Dump(swigCPtr, this);
}
public final static class KEY_TYPE {
public final static Key.KEY_TYPE RSA = new Key.KEY_TYPE("RSA");
public final static Key.KEY_TYPE RSA_PUBLIC = new Key.KEY_TYPE("RSA_PUBLIC");
public final static Key.KEY_TYPE AES = new Key.KEY_TYPE("AES");
public final static Key.KEY_TYPE EC = new Key.KEY_TYPE("EC");
public final static Key.KEY_TYPE EC_PUBLIC = new Key.KEY_TYPE("EC_PUBLIC");
public final static Key.KEY_TYPE STRING = new Key.KEY_TYPE("STRING");
public final static Key.KEY_TYPE AESHMAC = new Key.KEY_TYPE("AESHMAC");
public final static Key.KEY_TYPE GENERIC = new Key.KEY_TYPE("GENERIC");
public final int swigValue() {
return swigValue;
}
public String toString() {
return swigName;
}
public static KEY_TYPE swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
return swigValues[swigValue];
for (int i = 0; i < swigValues.length; i++)
if (swigValues[i].swigValue == swigValue)
return swigValues[i];
throw new IllegalArgumentException("No enum " + KEY_TYPE.class + " with value " + swigValue);
}
private KEY_TYPE(String swigName) {
this.swigName = swigName;
this.swigValue = swigNext++;
}
private KEY_TYPE(String swigName, int swigValue) {
this.swigName = swigName;
this.swigValue = swigValue;
swigNext = swigValue+1;
}
private KEY_TYPE(String swigName, KEY_TYPE swigEnum) {
this.swigName = swigName;
this.swigValue = swigEnum.swigValue;
swigNext = this.swigValue+1;
}
private static KEY_TYPE[] swigValues = { RSA, RSA_PUBLIC, AES, EC, EC_PUBLIC, STRING, AESHMAC, GENERIC };
private static int swigNext = 0;
private final int swigValue;
private final String swigName;
}
public final static class KEY_FORMAT {
public final static Key.KEY_FORMAT PEM = new Key.KEY_FORMAT("PEM");
public final static Key.KEY_FORMAT DER = new Key.KEY_FORMAT("DER");
public final static Key.KEY_FORMAT PKCS8 = new Key.KEY_FORMAT("PKCS8");
public final static Key.KEY_FORMAT PKCS12 = new Key.KEY_FORMAT("PKCS12");
public final static Key.KEY_FORMAT UNKNOWN_FORMAT = new Key.KEY_FORMAT("UNKNOWN_FORMAT");
public final int swigValue() {
return swigValue;
}
public String toString() {
return swigName;
}
public static KEY_FORMAT swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
return swigValues[swigValue];
for (int i = 0; i < swigValues.length; i++)
if (swigValues[i].swigValue == swigValue)
return swigValues[i];
throw new IllegalArgumentException("No enum " + KEY_FORMAT.class + " with value " + swigValue);
}
private KEY_FORMAT(String swigName) {
this.swigName = swigName;
this.swigValue = swigNext++;
}
private KEY_FORMAT(String swigName, int swigValue) {
this.swigName = swigName;
this.swigValue = swigValue;
swigNext = swigValue+1;
}
private KEY_FORMAT(String swigName, KEY_FORMAT swigEnum) {
this.swigName = swigName;
this.swigValue = swigEnum.swigValue;
swigNext = this.swigValue+1;
}
private static KEY_FORMAT[] swigValues = { PEM, DER, PKCS8, PKCS12, UNKNOWN_FORMAT };
private static int swigNext = 0;
private final int swigValue;
private final String swigName;
}
}