Struct yubihsm::commands::get_pubkey::PublicKey [−][src]
pub struct PublicKey { pub algorithm: AsymmetricAlg, pub bytes: Vec<u8>, }
Response from commands::get_pubkey
Fields
algorithm: AsymmetricAlg
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]
impl PublicKey
pub fn into_vec(self) -> Vec<u8>
[src]
pub fn into_vec(self) -> Vec<u8>
Unwrap inner byte vector
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Get length of the key
pub fn as_slice(&self) -> &[u8]
[src]
pub fn as_slice(&self) -> &[u8]
Get slice of the inner byte vector
Trait Implementations
impl Debug for PublicKey
[src]
impl Debug for PublicKey
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl AsRef<[u8]> for PublicKey
[src]
impl AsRef<[u8]> for PublicKey
impl Into<Vec<u8>> for PublicKey
[src]
impl Into<Vec<u8>> for PublicKey