HybridCrypto

Struct HybridCrypto 

Source
pub struct HybridCrypto { /* private fields */ }
Expand description

Main hybrid cryptography engine

Implementations§

Source§

impl HybridCrypto

Source

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();
Source

pub fn public_keys(&self) -> &PublicKeys

Get public keys for sharing

Source

pub fn security_manager(&self) -> &Arc<SecurityManager>

Get security manager for advanced security operations

Source

pub fn audit_security(&self) -> SecurityAuditResult

Run security audit on the current crypto instance

Source

pub fn encrypt( &self, data: &[u8], recipient_pubkeys: &PublicKeys, ) -> Result<HybridCiphertext>

Encrypt data for a recipient using hybrid encryption

§Arguments
  • data - The data to encrypt
  • recipient_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();
Source

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();
Source

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();
Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V