pub struct DigitalSignature {
pub algorithm: String,
pub signature: Vec<u8>,
pub public_key_fingerprint: String,
pub timestamp: SystemTime,
pub signer_certificate: Option<String>,
}Expand description
Digital signature for plugin verification
Digital signatures provide cryptographic verification of plugin integrity and authenticity. They ensure that plugins have not been tampered with and come from trusted sources.
§Supported Algorithms
- RSA-SHA256: Standard RSA signature with SHA-256 hashing
- ECDSA-P256: Elliptic curve signature with P-256 curve
- Ed25519: Edwards curve signature algorithm
§Examples
use sklears_core::plugin::DigitalSignature;
let signature = DigitalSignature {
algorithm: "RSA-SHA256".to_string(),
signature: vec![0x12, 0x34, 0x56, 0x78],
public_key_fingerprint: "SHA256:abc123def456".to_string(),
timestamp: std::time::SystemTime::now(),
signer_certificate: Some("-----BEGIN CERTIFICATE-----\n...".to_string()),
};Fields§
§algorithm: StringSignature algorithm used (e.g., “RSA-SHA256”, “ECDSA-P256”, “Ed25519”)
signature: Vec<u8>The actual signature bytes
public_key_fingerprint: StringFingerprint of the public key used for verification
timestamp: SystemTimeTimestamp when the signature was created
signer_certificate: Option<String>Optional signer certificate in PEM format
Implementations§
Source§impl DigitalSignature
impl DigitalSignature
Sourcepub fn new(
algorithm: String,
signature: Vec<u8>,
public_key_fingerprint: String,
) -> Self
pub fn new( algorithm: String, signature: Vec<u8>, public_key_fingerprint: String, ) -> Self
Create a new digital signature
§Arguments
algorithm- The signature algorithm usedsignature- The signature bytespublic_key_fingerprint- Fingerprint of the signing key
§Examples
use sklears_core::plugin::DigitalSignature;
let sig = DigitalSignature::new(
"RSA-SHA256".to_string(),
vec![0x12, 0x34],
"SHA256:abc123".to_string(),
);Sourcepub fn is_algorithm_supported(&self) -> bool
pub fn is_algorithm_supported(&self) -> bool
Verify the signature algorithm is supported
§Returns
true if the algorithm is supported, false otherwise.
Sourcepub fn security_strength(&self) -> u32
pub fn security_strength(&self) -> u32
Get the security strength of the signature algorithm
§Returns
Security strength in bits, or 0 for unknown algorithms.
Trait Implementations§
Source§impl Clone for DigitalSignature
impl Clone for DigitalSignature
Source§fn clone(&self) -> DigitalSignature
fn clone(&self) -> DigitalSignature
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DigitalSignature
impl Debug for DigitalSignature
Source§impl<'de> Deserialize<'de> for DigitalSignature
impl<'de> Deserialize<'de> for DigitalSignature
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
Auto Trait Implementations§
impl Freeze for DigitalSignature
impl RefUnwindSafe for DigitalSignature
impl Send for DigitalSignature
impl Sync for DigitalSignature
impl Unpin for DigitalSignature
impl UnwindSafe for DigitalSignature
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more