[−][src]Struct ehsm::EHSMContext
Implementations
impl EHSMContext
[src]
pub fn new<P>(filename: P) -> Result<EHSMContext, Error> where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Creates a new EHSMContext from the shared library name
Examples
use ehsm::*; let lib_name = ehsm_library_name(); let ehsm = EHSMContext::new(lib_name.as_path()).expect("Failed to load ehsm library functions");
pub fn has_bitcoin_key(
&self,
session: CK_SESSION_HANDLE,
handle: CK_OBJECT_HANDLE_PTR
) -> Result<bool, Error>
[src]
&self,
session: CK_SESSION_HANDLE,
handle: CK_OBJECT_HANDLE_PTR
) -> Result<bool, Error>
Returns true if the device has a bitcoin key object. If it does have a key, the object handle is returned in handle.
pub fn import_bitcoin_key(
&self,
session: CK_SESSION_HANDLE,
seed: &Vec<u8>
) -> Result<(), Error>
[src]
&self,
session: CK_SESSION_HANDLE,
seed: &Vec<u8>
) -> Result<(), Error>
Import a bitcoin key from the provided binary seed
pub fn sign_bitcoin_hash(
&self,
session: CK_SESSION_HANDLE,
hash: &Vec<u8>,
indexes: &Vec<u32>
) -> Result<Vec<u8>, Error>
[src]
&self,
session: CK_SESSION_HANDLE,
hash: &Vec<u8>,
indexes: &Vec<u32>
) -> Result<Vec<u8>, Error>
Sign the provided hash with the private key at the specified BIP32 path. The path is defined by the indexes provided.
Examples
use ehsm::*; // empty index vector is the root key or "m" // for "m/0", just add 0 to indexes, i.e. indexes.push(0) etc. to build the BIP32 path let mut indexes: Vec<u32> = Vec::new(); // let sig = ehsm.sign_bitcoin_hash(session,&vec![0;32],&indexes).expect("Failed to sign hash");
pub fn get_bitcoin_pub(
&self,
session: CK_SESSION_HANDLE,
indexes: &Vec<u32>,
net: u32
) -> Result<String, Error>
[src]
&self,
session: CK_SESSION_HANDLE,
indexes: &Vec<u32>,
net: u32
) -> Result<String, Error>
Get the BTC base58 encoded public key at the specified BIP32 path. The path is defined by the indexes provided.
Examples
use ehsm::*; // empty index vector is the root key or "m" // for "m/0", just add 0 to indexes, i.e. indexes.push(0) etc. to build the BIP32 path let mut indexes: Vec<u32> = Vec::new(); // main net let net: u32 = 0x0488B21Eu32; // let xpub = ehsm.get_bitcoin_pub(session, &indexes, net).expect("Failed to get btc pub");
Auto Trait Implementations
impl RefUnwindSafe for EHSMContext
impl Send for EHSMContext
impl Sync for EHSMContext
impl Unpin for EHSMContext
impl UnwindSafe for EHSMContext
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,