This repository has been archived by the owner on Feb 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathProprietaryAPI.java
73 lines (69 loc) · 3.02 KB
/
ProprietaryAPI.java
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
/*
*******************************************************************************
* Java Card Bitcoin Hardware Wallet
* (c) 2015 Ledger
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************
*/
package com.ledger.wallet;
import javacard.security.Key;
/**
* Implements proprietary features not present in the Java Card API or optimizations
* @author BTChip
*
*/
public interface ProprietaryAPI {
/**
* Get the uncompressed public key
* @param privateKey buffer containing the private key
* @param privateKeyOffset offset to the private key in the buffer
* @param publicPoint buffer that will contain the uncompressed public key (65 bytes)
* @param publicPointOffset offset to the uncompressed public key in the buffer
* @return true if ok, false if an error occurred
*/
public boolean getUncompressedPublicPoint(byte[] privateKey, short privateKeyOffset, byte[] publicPoint, short publicPointOffset);
/**
* Check if there is an optimized support for HMAC SHA512
* @return true if it's present, otherwise false
*/
public boolean hasHmacSHA512();
/**
* Perform an optimized HMAC SHA512 operation
* @param key HMAC key object provisioned with the HMAC key
* @param in buffer containing the data to HMAC
* @param inBuffer offset to the data
* @param inLength length of the data
* @param out buffer that will contain the HMAC SHA512 result
* @param outOffset offset to the result
*/
public void hmacSHA512(Key key, byte[] in, short inBuffer, short inLength, byte[] out, short outOffset);
/**
* Check if deterministic ECDSA SHA-256 signature is supported
* @return true if it's present, otherwise false
*/
public boolean hasDeterministicECDSASHA256();
/**
* Perform a deterministic ECDSA SHA-256 signature
* Non malleability is not guaranteed and should be checked by the host
* (see https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki#low-s-values-in-signatures)
* @param key Private ECC key object provisioned with the signature key
* @param in buffer containing the data to hash and sign
* @param inBuffer offset to the data
* @param inLength length of the data
* @param out buffer that will contain the signature
* @param outOffset offset to the signature
*/
public void signDeterministicECDSASHA256(Key key, byte[] in, short inBuffer, short inLength, byte[] out, short outOffset);
}