File: supported-algorithms.rs

package info (click to toggle)
rust-sequoia-openpgp 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,372 kB
  • sloc: sh: 6; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 1,409 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! This example prints all algorithms supported by the currently
//! selected cryptographic backend.

use sequoia_openpgp as openpgp;
use openpgp::types::*;
use openpgp::cert::CipherSuite;

fn main() {
    println!("Cipher suites:");
    for a in CipherSuite::variants() {
        println!(" - {:70} {:?}", format!("{:?}", a), a.is_supported().is_ok());
    }
    println!();

    println!("Public-Key algorithms:");
    for a in PublicKeyAlgorithm::variants() {
        println!(" - {:70} {:?}", a.to_string(), a.is_supported());
    }
    println!();

    println!("ECC algorithms:");
    for a in Curve::variants() {
        println!(" - {:70} {:?}", a.to_string(), a.is_supported());
    }
    println!();

    println!("Symmetric algorithms:");
    for a in SymmetricAlgorithm::variants() {
        println!(" - {:70} {:?}", a.to_string(), a.is_supported());
    }
    println!();

    println!("AEAD algorithms:");
    for a in AEADAlgorithm::variants() {
        println!(" - {:70} {:?}", a.to_string(), a.is_supported());
    }
    println!();

    println!("Hash algorithms:");
    for a in HashAlgorithm::variants() {
        println!(" - {:70} {:?}", a.to_string(), a.is_supported());
    }
    println!();

    println!("Compression algorithms:");
    for a in CompressionAlgorithm::variants().skip(1) {
        println!(" - {:70} {:?}", a.to_string(), a.is_supported());
    }
    println!();
}