pub struct HybridCrypto { /* private fields */ }Expand description
Main hybrid cryptography engine
Implementations§
Source§impl HybridCrypto
impl HybridCrypto
Sourcepub fn generate_keypair() -> Result<Self>
pub fn generate_keypair() -> Result<Self>
Generate a new keypair with all algorithms (RSA + Kyber + Dilithium)
§Example
use quantum_shield::HybridCrypto;
let crypto = HybridCrypto::generate_keypair().unwrap();Sourcepub fn public_keys(&self) -> &PublicKeys
pub fn public_keys(&self) -> &PublicKeys
Get public keys for sharing
Sourcepub fn security_manager(&self) -> &Arc<SecurityManager>
pub fn security_manager(&self) -> &Arc<SecurityManager>
Get security manager for advanced security operations
Sourcepub fn audit_security(&self) -> SecurityAuditResult
pub fn audit_security(&self) -> SecurityAuditResult
Run security audit on the current crypto instance
Sourcepub fn encrypt(
&self,
data: &[u8],
recipient_pubkeys: &PublicKeys,
) -> Result<HybridCiphertext>
pub fn encrypt( &self, data: &[u8], recipient_pubkeys: &PublicKeys, ) -> Result<HybridCiphertext>
Encrypt data for a recipient using hybrid encryption
§Arguments
data- The data to encryptrecipient_pubkeys- The recipient’s public keys
§Example
use quantum_shield::HybridCrypto;
let alice = HybridCrypto::generate_keypair().unwrap();
let bob = HybridCrypto::generate_keypair().unwrap();
let encrypted = alice.encrypt(b"secret", &bob.public_keys()).unwrap();Sourcepub fn decrypt(&self, ciphertext: &HybridCiphertext) -> Result<Vec<u8>>
pub fn decrypt(&self, ciphertext: &HybridCiphertext) -> Result<Vec<u8>>
Decrypt data using hybrid decryption (automatic failover RSA → Kyber)
§Example
let decrypted = bob.decrypt(&encrypted).unwrap();Sourcepub fn sign(&self, message: &[u8]) -> Result<HybridSignature>
pub fn sign(&self, message: &[u8]) -> Result<HybridSignature>
Sign a message with hybrid signatures (RSA + Dilithium)
§Example
let alice = HybridCrypto::generate_keypair().unwrap();
let signature = alice.sign(b"message to sign").unwrap();Sourcepub fn verify(
message: &[u8],
signature: &HybridSignature,
pubkeys: &PublicKeys,
) -> Result<bool>
pub fn verify( message: &[u8], signature: &HybridSignature, pubkeys: &PublicKeys, ) -> Result<bool>
Verify a hybrid signature
§Example
let valid = HybridCrypto::verify(message, &signature, &alice.public_keys()).unwrap();
assert!(valid);Auto Trait Implementations§
impl Freeze for HybridCrypto
impl RefUnwindSafe for HybridCrypto
impl Send for HybridCrypto
impl Sync for HybridCrypto
impl Unpin for HybridCrypto
impl UnwindSafe for HybridCrypto
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