Trait nacos_sdk::api::plugin::EncryptionPlugin

source ·
pub trait EncryptionPlugin: Send + Sync {
    // Required methods
    fn encrypt<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        secret_key: &'life1 str,
        content: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn decrypt<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        secret_key: &'life1 str,
        content: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn generate_secret_key<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn algorithm_name(&self) -> String;
    fn encrypt_secret_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        secret_key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn decrypt_secret_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        secret_key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn need_cipher(&self, data_id: &str) -> bool { ... }
    fn parse_algorithm_name(&self, data_id: &str) -> String { ... }
}
Expand description

EncryptionPlugin for Config.

Required Methods§

source

fn encrypt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, secret_key: &'life1 str, content: &'life2 str, ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

  • Encrypt interface.
  • @param secret_key secret key
  • @param content content unencrypted
  • @return encrypt value
source

fn decrypt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, secret_key: &'life1 str, content: &'life2 str, ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

  • Decrypt interface.
  • @param secret_key secret key
  • @param content encrypted
  • @return decrypt value
source

fn generate_secret_key<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

  • Generate secret key. It only be known by you.
  • @return Secret key
source

fn algorithm_name(&self) -> String

  • Algorithm name. e.g. AES,AES128,AES256,DES,3DES,…
  • @return name
source

fn encrypt_secret_key<'life0, 'life1, 'async_trait>( &'life0 self, secret_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

  • Encrypt secret Key. It will be transmitted in the network.
  • @param secretKey secretKey
  • @return encrypted secretKey
source

fn decrypt_secret_key<'life0, 'life1, 'async_trait>( &'life0 self, secret_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

  • Decrypt secret Key.
  • @param secret_key secretKey
  • @return decrypted secretKey

Provided Methods§

source

fn need_cipher(&self, data_id: &str) -> bool

  • Whether need to do cipher.
  • e.g. data_id = “cipher-AES-dataId”
source

fn parse_algorithm_name(&self, data_id: &str) -> String

  • Parse encryption algorithm name.
  • @param data_id data_id
  • @return algorithm name

Implementors§