Bitcoin ABC
0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
src
secp256k1
src
java
org
bitcoin
Secp256k1Context.java
Go to the documentation of this file.
1
/*
2
* Copyright 2014-2016 the libsecp256k1 contributors
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* https://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
package
org.bitcoin;
18
23
public
class
Secp256k1Context
{
24
private
static
final
boolean
enabled
;
//true if the library is loaded
25
private
static
final
long
context
;
//ref to pointer to context obj
26
27
static
{
//static initializer
28
boolean
isEnabled
=
true
;
29
long
contextRef
= -1;
30
try
{
31
System
.loadLibrary(
"secp256k1_jni"
);
32
contextRef
=
secp256k1_init_context
();
33
}
catch
(
UnsatisfiedLinkError
e
) {
34
System
.out.println(
"UnsatisfiedLinkError: "
+
e
.toString());
35
isEnabled
=
false
;
36
}
37
enabled
=
isEnabled
;
38
context
=
contextRef
;
39
}
40
41
public
static
boolean
isEnabled
() {
42
return
enabled
;
43
}
44
45
public
static
long
getContext
() {
46
if
(!
enabled
)
return
-1;
//sanity check
47
return
context
;
48
}
49
50
private
static
native
long
secp256k1_init_context
();
51
}
org.bitcoin.Secp256k1Context
This class holds the context reference used in native methods to handle ECDSA operations.
Definition
Secp256k1Context.java:23
org.bitcoin.Secp256k1Context.isEnabled
static boolean isEnabled()
Definition
Secp256k1Context.java:41
org.bitcoin.Secp256k1Context.secp256k1_init_context
static native long secp256k1_init_context()
org.bitcoin.Secp256k1Context.getContext
static long getContext()
Definition
Secp256k1Context.java:45
org.bitcoin.Secp256k1Context.enabled
static final boolean enabled
Definition
Secp256k1Context.java:24
org.bitcoin.Secp256k1Context.context
static final long context
Definition
Secp256k1Context.java:25
GetRand
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition
random.h:85
Generated on Fri Dec 27 2024 02:38:18 for Bitcoin ABC by
1.9.8