Struct yubihsm::asymmetric::PublicKey
source · pub struct PublicKey {
pub algorithm: Algorithm,
pub bytes: Vec<u8>,
}
Expand description
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.
Implementations§
source§impl PublicKey
impl PublicKey
sourcepub fn ecdsa<C>(&self) -> Option<EncodedPoint<C>>where
C: PrimeCurve + CurveAlgorithm + PointCompression,
FieldBytesSize<C>: ModulusSize,
pub fn ecdsa<C>(&self) -> Option<EncodedPoint<C>>where C: PrimeCurve + CurveAlgorithm + PointCompression, FieldBytesSize<C>: ModulusSize,
Return the ECDSA public key of the given curve type if applicable
Trait Implementations§
source§impl<'de> Deserialize<'de> for PublicKey
impl<'de> Deserialize<'de> for PublicKey
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<PublicKey> for PublicKey
impl PartialEq<PublicKey> for PublicKey
impl Eq for PublicKey
impl StructuralEq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more