public class LunaKeyPairDerivationBIP32Master
extends java.security.KeyPairGeneratorSpi
KeyPair
.Modifier and Type | Field and Description |
---|---|
protected LunaPkcs11Attributes |
attributes |
protected LunaKey |
baseKey
Base key from which to derive a KeyPair.
|
protected static java.util.logging.Logger |
LOGGER |
protected LunaNamedCurve |
mCurve
Bip32 curve is "secp256k1"
|
protected long |
mechType
Specifies either master or child KeyPair to be derived.
|
protected int[] |
path
An integer array containing the key derivation path elements.
|
Constructor and Description |
---|
LunaKeyPairDerivationBIP32Master() |
Modifier and Type | Method and Description |
---|---|
protected int[] |
convertPath(java.lang.String pathStr)
Convert the BIP32 key path to an integer array for passing to the HSM.
|
java.security.KeyPair |
generateKeyPair()
Derive the KeyPair.
|
void |
initialize(java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
Initialize the BIP32 key derivation operation based on the supplied LunaBIP32ParameterSpec.
|
void |
initialize(int i,
java.security.SecureRandom secureRandom)
Not implemented.
|
protected static final java.util.logging.Logger LOGGER
protected LunaNamedCurve mCurve
protected long mechType
protected LunaKey baseKey
protected int[] path
protected LunaPkcs11Attributes attributes
protected int[] convertPath(java.lang.String pathStr)
Note: The path MUST be specified using the notation in the BIP44 specification: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#path-levels
Example: "m/12'/34'/56/78"
Observe:
Path elements ending with an apostrophe "'" will be created as hardened keys. A leading "m" is decorative only.
pathStr
- the string representation of the pathpublic void initialize(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterException
initialize
in class java.security.KeyPairGeneratorSpi
params
- an instance of a LunaBIP32ParameterSpecrandom
- unusedjava.security.InvalidAlgorithmParameterException
- If the parameterspec is not a LunaBIP32ParameterSpecjava.security.InvalidParameterException
- If base key is unspecifiedpublic void initialize(int i, java.security.SecureRandom secureRandom)
initialize
in class java.security.KeyPairGeneratorSpi
public java.security.KeyPair generateKeyPair()
generateKeyPair
in class java.security.KeyPairGeneratorSpi
KeyPair
object containing the public and private keys.Copyright 2014-2018 SafeNet. All rights reserved.