GcrCertificateRequest

## GcrCertificateRequest GcrCertificateRequest — Represents a certificate request |

## Functions

gboolean | gcr_certificate_request_capable ()
void | gcr_certificate_request_capable_async ()
gboolean | gcr_certificate_request_capable_finish ()
GcrCertificateRequest * | gcr_certificate_request_prepare ()
GcrCertificateRequestFormat | gcr_certificate_request_get_format ()
GckObject * | gcr_certificate_request_get_private_key ()
void | gcr_certificate_request_set_cn ()
gboolean | gcr_certificate_request_complete ()
void | gcr_certificate_request_complete_async ()
gboolean | gcr_certificate_request_complete_finish ()
guchar * | gcr_certificate_request_encode ()

## Types and Values

| GcrCertificateRequest
enum | GcrCertificateRequestFormat

## Description

This is an object that allows creation of certificate requests. A certificate request is sent to a certificate authority to request an X.509 certificate.

Use `gcr_certificate_request_prepare()` to create a blank certificate request for a given private key. Set the common name on the certificate request with `gcr_certificate_request_set_cn()`, and then sign the request with `gcr_certificate_request_complete_async()`.

## Functions

### gcr_certificate_request_capable ()

    gboolean
    gcr_certificate_request_capable (GckObject *private_key,
                                     GCancellable *cancellable,
                                     GError **error);

Check whether GcrCertificateRequest is capable of creating a request for the given `private_key` .

#### Parameters

private_key | a private key |
cancellable | cancellation object |
error | location to place an error |

#### Returns

whether a request can be created

### gcr_certificate_request_capable_async ()

    void
    gcr_certificate_request_capable_async (GckObject *private_key,
                                           GCancellable *cancellable,
                                           GAsyncReadyCallback callback,
                                           gpointer user_data);

Asynchronously check whether GcrCertificateRequest is capable of creating a request for the given `private_key` .

#### Parameters

private_key | a private key |
cancellable | cancellation object |
callback | will be called when the operation completes |
user_data | data to be passed to callback |

### gcr_certificate_request_capable_finish ()

    gboolean
    gcr_certificate_request_capable_finish
                                   (GAsyncResult *result,
                                    GError **error);

Get the result for asynchronously check whether GcrCertificateRequest is capable of creating a request for the given `private_key` .

#### Parameters

result | asynchronous result |
error | location to place an error |

#### Returns

whether a request can be created

### gcr_certificate_request_prepare ()

    GcrCertificateRequest *
    gcr_certificate_request_prepare (GcrCertificateRequestFormat format,
                                     GckObject *private_key);

Create a new certificate request, in the given format for the private key.

#### Parameters

format | the format for the certificate request |
private_key | the private key the the certificate is being requested for |

#### Returns

a new GcrCertificate request.

[transfer full]

### gcr_certificate_request_get_format ()

    GcrCertificateRequestFormat
    gcr_certificate_request_get_format (GcrCertificateRequest *self);

Get the format of this certificate request.

#### Parameters

self | the certificate request |

#### Returns

the format

### gcr_certificate_request_get_private_key ()

    GckObject *
    gcr_certificate_request_get_private_key
                                   (GcrCertificateRequest *self);

Get the private key this certificate request is for.

#### Parameters

self | the certificate request |

#### Returns

the private key,.

[transfer none]

### gcr_certificate_request_set_cn ()

    void
    gcr_certificate_request_set_cn (GcrCertificateRequest *self,
                                    const gchar *cn);

Set the common name encoded in the certificate request.

#### Parameters

self | the certificate request |
cn | common name to set on the request |

### gcr_certificate_request_complete ()

    gboolean
    gcr_certificate_request_complete (GcrCertificateRequest *self,
                                      GCancellable *cancellable,
                                      GError **error);

Complete and sign a certificate request, so that it can be encoded and sent to a certificate authority.

This call may block as it signs the request using the private key.

#### Parameters

self | a certificate request |
cancellable | a cancellation object |
error | location to place an error on failure |

#### Returns

whether certificate request was successfully completed or not

### gcr_certificate_request_complete_async ()

    void
    gcr_certificate_request_complete_async
                                   (GcrCertificateRequest *self,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Asynchronously complete and sign a certificate request, so that it can be encoded and sent to a certificate authority.

This call will return immediately and complete later.

#### Parameters

self | a certificate request |
cancellable | a cancellation object |
callback | called when the operation completes |
user_data | data to pass to the callback |

### gcr_certificate_request_complete_finish ()

    gboolean
    gcr_certificate_request_complete_finish
                                   (GcrCertificateRequest *self,
                                    GAsyncResult *result,
                                    GError **error);

Finish an asynchronous operation to complete and sign a certificate request.

#### Parameters

self | a certificate request |
result | result of the asynchronous operation |
error | location to place an error on failure |

#### Returns

whether certificate request was successfully completed or not

### gcr_certificate_request_encode ()

    guchar *
    gcr_certificate_request_encode (GcrCertificateRequest *self,
                                    gboolean textual,
                                    gsize *length);

Encode the certificate request. It must have been completed with `gcr_certificate_request_complete()` or `gcr_certificate_request_complete_async()`

If `textual` is `FALSE`, the output is a DER encoded certificate request.

If `textual` is `TRUE`, the output is encoded as text. For PKCS#10 requests this is done using the OpenSSL style PEM encoding.

#### Parameters

self | a certificate request |
textual | whether to encode output as text |
length | location to place length of returned data |

#### Returns

the encoded certificate request.

[transfer full][array length=length]

## Types and Values

### GcrCertificateRequest

    typedef struct _GcrCertificateRequest GcrCertificateRequest;

Represents a certificate request.

### enum GcrCertificateRequestFormat

The format of a certificate request. Currently only PKCS#10 is supported.

#### Members

GCR_CERTIFICATE_REQUEST_PKCS10 | certificate request is in PKCS#10 format |