pub struct X509 { /* private fields */ }
Expand description
This is a wrapper around the OpenSSL
X509
cert
Implementations
sourceimpl X509
impl X509
pub fn from_der(der: &[u8]) -> Result<X509, X509Error>
sourcepub fn cert_and_pkey(
x509_data: &X509Data
) -> Result<(X509, PKey<Private>), String>
pub fn cert_and_pkey(
x509_data: &X509Data
) -> Result<(X509, PKey<Private>), String>
Creates a self-signed X509v3 certificate and public/private key from the supplied creation args. The certificate identifies an instance of the application running on a host as well as the public key. The PKey holds the corresponding public/private key. Note that if the pkey is stored by cert store, then only the private key will be written. The public key is only ever stored with the cert.
See Part 6 Table 23 for full set of requirements
In particular, application instance cert requires subjectAltName to specify alternate hostnames / ip addresses that the host runs on.
pub fn from_pkey(
pkey: &PKey<Private>,
x509_data: &X509Data
) -> Result<X509, String>
pub fn from_byte_string(data: &ByteString) -> Result<X509, StatusCode>
sourcepub fn as_byte_string(&self) -> ByteString
pub fn as_byte_string(&self) -> ByteString
Returns a ByteString representation of the cert which is DER encoded form of X509v3
pub fn public_key(&self) -> Result<PKey<Public>, StatusCode>
sourcepub fn key_length(&self) -> Result<usize, X509Error>
pub fn key_length(&self) -> Result<usize, X509Error>
Returns the key length in bits (if possible)
pub fn subject_name(&self) -> String
sourcepub fn common_name(&self) -> Result<String, X509Error>
pub fn common_name(&self) -> Result<String, X509Error>
Gets the common name out of the cert
sourcepub fn is_time_valid(&self, now: &DateTime<Utc>) -> StatusCode
pub fn is_time_valid(&self, now: &DateTime<Utc>) -> StatusCode
Tests if the certificate is valid for the supplied time using the not before and not after values on the cert.
sourcepub fn is_hostname_valid(&self, hostname: &str) -> StatusCode
pub fn is_hostname_valid(&self, hostname: &str) -> StatusCode
Tests if the supplied hostname matches any of the dns alt subject name entries on the cert
sourcepub fn is_application_uri_valid(&self, application_uri: &str) -> StatusCode
pub fn is_application_uri_valid(&self, application_uri: &str) -> StatusCode
Tests if the supplied application uri matches the uri alt subject name entry on the cert
sourcepub fn thumbprint(&self) -> Thumbprint
pub fn thumbprint(&self) -> Thumbprint
OPC UA Part 6 MessageChunk structure
The thumbprint is the SHA1 digest of the DER form of the certificate. The hash is 160 bits (20 bytes) in length and is sent in some secure conversation headers.
The thumbprint might be used by the server / client for look-up purposes.
sourcepub fn not_before(&self) -> Result<DateTime<Utc>, X509Error>
pub fn not_before(&self) -> Result<DateTime<Utc>, X509Error>
Turn the Asn1 values into useful portable types
sourcepub fn not_after(&self) -> Result<DateTime<Utc>, X509Error>
pub fn not_after(&self) -> Result<DateTime<Utc>, X509Error>
Turn the Asn1 values into useful portable types
pub fn to_der(&self) -> Result<Vec<u8, Global>, X509Error>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for X509
impl Send for X509
impl Sync for X509
impl Unpin for X509
impl UnwindSafe for X509
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> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more