Struct rccheck::ed25519_certgen::Ed25519
source · [−]pub struct Ed25519 {}
Trait Implementations
sourceimpl Certifiable for Ed25519
impl Certifiable for Ed25519
sourcefn keypair_to_certificate(
subject_names: impl Into<Vec<String>>,
kp: Self::KeyPair
) -> Result<Certificate, Error>
fn keypair_to_certificate(
subject_names: impl Into<Vec<String>>,
kp: Self::KeyPair
) -> Result<Certificate, Error>
KISS function to generate a self signed certificate from a dalek keypair Given a set of domain names you want your certificate to be valid for, this function fills in the other generation parameters with reasonable defaults and generates a self signed certificate using the keypair passed as argument as output.
Example
extern crate rccheck;
use rccheck::ed25519_certgen::Ed25519;
use rccheck::Certifiable;
let subject_alt_names = vec!["localhost".to_string()];
let kp = ed25519_dalek::Keypair::generate(&mut rng);
let cert = Ed25519::keypair_to_certificate(subject_alt_names, kp).unwrap();
// The certificate is now valid for localhost
sourcefn public_key_to_spki(public_key: &Self::PublicKey) -> Vec<u8>
fn public_key_to_spki(public_key: &Self::PublicKey) -> Vec<u8>
This produces X.509 SubjectPublicKeyInfo
(SPKI) as defined in [RFC 5280 Section 4.1.2.7].
in DER-encoded format, serialized to a byte string.
Example
use rccheck::*;
let mut rng = rand::thread_rng();
let keypair = ed25519_dalek::Keypair::generate(&mut rng);
let spki = ed25519_certgen::Ed25519::public_key_to_spki(&keypair.public); // readable by Psk::from_der
type PublicKey = PublicKey
type KeyPair = Keypair
Auto Trait Implementations
impl RefUnwindSafe for Ed25519
impl Send for Ed25519
impl Sync for Ed25519
impl Unpin for Ed25519
impl UnwindSafe for Ed25519
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more