[][src]Struct yubihsm::asymmetric::PublicKey

pub struct PublicKey {
    pub algorithm: Algorithm,
    pub bytes: Vec<u8>,
}

Response from command::get_public_key

Fields

algorithm: Algorithm

Algorithm of the public key

bytes: Vec<u8>

The public key in raw bytes. Keys have the following structure:

  • RSA: Public modulus N (0x100 | 0x200 | 0x400 bytes)
  • ECC (non-Ed25519):
    • Public point X (0x20 | 0x30 | 0x40 | 0x42 bytes)
    • Public point Y (0x20 | 0x30 | 0x40 | 0x42 bytes)
  • Ed25519: Public point A, compressed (0x20 bytes)

In particular note that in the case of e.g. ECDSA public keys, many libraries will expect a 0x04 (DER OCTET STRING) tag byte at the beginning of the key. The YubiHSM does not return this, so you may need to add it depending on your particular application.

Methods

impl PublicKey[src]

pub fn into_vec(self) -> Vec<u8>[src]

Unwrap inner byte vector

pub fn len(&self) -> usize[src]

Get length of the key

pub fn as_slice(&self) -> &[u8][src]

Get slice of the inner byte vector

Trait Implementations

impl PartialEq<PublicKey> for PublicKey[src]

impl AsRef<[u8]> for PublicKey[src]

impl Clone for PublicKey[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Into<Vec<u8>> for PublicKey[src]

impl Eq for PublicKey[src]

impl Debug for PublicKey[src]

impl Serialize for PublicKey[src]

impl<'de> Deserialize<'de> for PublicKey[src]

Auto Trait Implementations

impl Send for PublicKey

impl Sync for PublicKey

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]