aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/standalone/libs/jni/cpp_utils.hpp
blob: ed26c01e408e513fe923d7b643382f4fcd258c72 (plain) (blame)
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
#pragma once

#include "native.h"
#include <string>

/**
 * Classes that are accessed alot are cached here, manually.
 */
extern jclass ec_parameter_spec_class;
extern jclass ecgen_parameter_spec_class;
extern jclass secret_key_spec_class;
extern jclass pubkey_class;
extern jclass privkey_class;
extern jclass keypair_class;
extern jclass elliptic_curve_class;
extern jclass fp_field_class;
extern jclass f2m_field_class;
extern jclass point_class;
extern jclass biginteger_class;
extern jclass illegal_state_exception_class;

/**
 * Initialize the classes.
 */
void init_classes(JNIEnv *env, std::string lib_name);

/**
 * Throw a new exception of class with message.
 */
void throw_new(JNIEnv *env, const std::string& klass, const std::string& message);

/**
 * Get the size of the specified key algorithm in bits, for ECDH KDF output size.
 */
jint get_kdf_bits(JNIEnv *env, jstring algorithm);

/**
 * Add a KeyPairGeneratorSpi class to this provider.
 */
void add_kpg(JNIEnv *env, const std::string &type, const std::string &klass, jobject provider, jmethodID put_method);

/**
 * Add a KeyAgreementSpi class to this provider.
 */
void add_ka(JNIEnv *env, const std::string &type, const std::string &klass, jobject provider, jmethodID put_method);

/**
 * Add a SignatureSpi class to this provider.
 */
void add_sig(JNIEnv *env, const std::string &type, const std::string &klass, jobject provider, jmethodID put_method);