# Struct openssl::x509::X509Ref [−] [src]

    pub struct X509Ref(_);

Reference to `X509`.

## Implementations

### `impl X509Ref` [src]

#### `pub fn subject_name(&self) -> &X509NameRef` [src]

Returns this certificate’s subject name.

This corresponds to `X509_get_subject_name`.

#### `pub fn subject_name_hash(&self) -> u32` [src]

Returns the hash of the certificates subject

This corresponds to `X509_subject_name_hash`.

#### `pub fn issuer_name(&self) -> &X509NameRef` [src]

Returns this certificate’s issuer name.

This corresponds to `X509_get_issuer_name`.

#### `pub fn subject_alt_names(&self) -> Option<Stack<GeneralName>>` [src]

Returns this certificate’s subject alternative name entries, if they exist.

This corresponds to `X509_get_ext_d2i` called with `NID_subject_alt_name`.

#### `pub fn issuer_alt_names(&self) -> Option<Stack<GeneralName>>` [src]

Returns this certificate’s issuer alternative name entries, if they exist.

This corresponds to `X509_get_ext_d2i` called with `NID_issuer_alt_name`.

#### `pub fn public_key(&self) -> Result<PKey<Public>, ErrorStack>` [src]

#### `pub fn digest(
&self,
hash_type: MessageDigest
) -> Result<DigestBytes, ErrorStack>` [src]

Returns a digest of the DER representation of the certificate.

This corresponds to `X509_digest`.

#### `pub fn fingerprint(
&self,
hash_type: MessageDigest
) -> Result<Vec<u8>, ErrorStack>` [src]

👎 Deprecated since 0.10.9:

renamed to digest

#### `pub fn not_after(&self) -> &Asn1TimeRef` [src]

Returns the certificate’s Not After validity period.

#### `pub fn not_before(&self) -> &Asn1TimeRef` [src]

Returns the certificate’s Not Before validity period.

#### `pub fn signature(&self) -> &Asn1BitStringRef` [src]

Returns the certificate’s signature

#### `pub fn signature_algorithm(&self) -> &X509AlgorithmRef` [src]

Returns the certificate’s signature algorithm.

#### `pub fn ocsp_responders(&self) -> Result<Stack<OpensslString>, ErrorStack>` [src]

Returns the list of OCSP responder URLs specified in the certificate’s Authority Information Access field.

#### `pub fn issued(&self, subject: &X509Ref) -> X509VerifyResult` [src]

Checks that this certificate issued `subject`.

#### `pub fn version(&self) -> i32` [src]

Returns certificate version. If this certificate has no explicit version set, it defaults to version 1.

Note that `0` return value stands for version 1, `1` for version 2 and so on.

This corresponds to `X509_get_version`.

#### `pub fn verify<T>(&self, key: &PKeyRef<T>) -> Result<bool, ErrorStack> where
T: HasPublic,` [src]

Check if the certificate is signed using the given public key.

Only the signature is checked: no other checks (such as certificate chain validity) are performed.

Returns `true` if verification succeeds.

This corresponds to [`X509_verify“].

#### `pub fn serial_number(&self) -> &Asn1IntegerRef` [src]

Returns this certificate’s serial number.

This corresponds to `X509_get_serialNumber`.

#### `pub fn to_pem(&self) -> Result<Vec<u8>, ErrorStack>` [src]

Serializes the certificate into a PEM-encoded X509 structure.

The output will have a header of `-----BEGIN CERTIFICATE-----`.

This corresponds to `PEM_write_bio_X509`.

#### `pub fn to_der(&self) -> Result<Vec<u8>, ErrorStack>` [src]

Serializes the certificate into a DER-encoded X509 structure.

This corresponds to `i2d_X509`.

## Trait Implementations

### `impl AsRef<X509Ref> for X509` [src]

#### `fn as_ref(&self) -> &X509Ref` [src]

Performs the conversion.

### `impl AsRef<X509Ref> for X509Ref` [src]

#### `fn as_ref(&self) -> &X509Ref` [src]

Performs the conversion.

### `impl Borrow<X509Ref> for X509` [src]

#### `fn borrow(&self) -> &X509Ref` [src]

Immutably borrows from an owned value. Read more

### `impl ForeignTypeRef for X509Ref` [src]

#### `type CType = X509`

The raw C type.

#### `pub unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self` [src]

Constructs a shared instance of this type from its raw type.

#### `pub unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self` [src]

Constructs a mutable reference of this type from its raw type.

#### `pub fn as_ptr(&self) -> *mut Self::CType` [src]

Returns a raw pointer to the wrapped value.

### `impl Send for X509Ref` [src]

### `impl Sync for X509Ref` [src]

### `impl ToOwned for X509Ref` [src]

#### `type Owned = X509`

The resulting type after obtaining ownership.

#### `fn to_owned(&self) -> X509` [src]

Creates owned data from borrowed data, usually by cloning. Read more

#### `pub fn clone_into(&self, target: &mut Self::Owned)` [src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

## Auto Trait Implementations

### `impl !RefUnwindSafe for X509Ref`

### `impl Unpin for X509Ref`

### `impl UnwindSafe for X509Ref`

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

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

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.