• BlackBerry Dynamics
  • Runtime library for iOS applications
  • 10.2.0.83
GDCredential.h
Go to the documentation of this file.
1 /*
2  * (c) 2018 BlackBerry Limited. All rights reserved.
3  */
4 
5 #ifndef GD_CREDENTIAL_H
6 #define GD_CREDENTIAL_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #ifndef GD_C_API
13 # if !defined(_WIN32)
14 # define GD_C_API __attribute__((visibility("default")))
15 # else
16 # define GD_C_API
17 # endif
18 #endif
19 
20 #include "GDCommon.h"
21 #include <time.h>
22 
46 struct GD_C_API GDX509Certificate {
53  char* issuer;
54 
61  char* subject;
62 
71 
78  char* serialNumber;
79 
87  char* publicKeyMD5;
88 
97 
106 
115 
122  time_t notBefore;
123 
130  time_t notAfter;
131 
137  bool valid;
138 
143  char* keyUsage;
144 
150 
157  char* alias;
158 
164  struct GDData x509;
165 };
166 
170 struct GD_C_API GDX509;
171 
181 GD_C_API struct GDX509Certificate* GDX509Certificate_create(const struct GDX509* certificate);
182 
189 GD_C_API void GDX509Certificate_free(struct GDX509Certificate* certificate);
190 
199 GD_C_API int GDX509Certificate_days_until_expiry(const struct GDX509Certificate* certificate);
200 
211 GD_C_API int GDX509Certificate_days_until_renewal_due(const struct GDX509Certificate* certificate);
212 
227 GD_C_API const char* GDX509Certificate_issuer_relative_name(const struct GDX509Certificate* certificate, const char* relative_name);
228 
243 GD_C_API const char* GDX509Certificate_subject_relative_name(const struct GDX509Certificate* certificate, const char* relative_name);
244 
245 
252 struct GD_C_API GDCredential {
259 
266  size_t auxCount;
267 
278 };
279 
361  GD_C_API bool GDCredential_import(char** profileId,
362  const struct GDData* credential,
363  const char* password,
364  struct GDError* error);
365 
377 GD_C_API void GDCredential_importDone(void);
378 
392 GD_C_API bool GDCredential_undoImport(const char* profileId);
393 
405 GD_C_API struct GDCredential* GDCredential_find(const char* issuer, const char* serial);
406 
417 GD_C_API bool GDCredential_remove_credential(const struct GDCredential* credential);
418 
430 GD_C_API bool GDCredential_remove(const char* issuer, const char* serial);
431 
481 GD_C_API bool GDCredential_list(const char* profileId,
482  size_t* credentialCount,
483  struct GDCredential** credentials,
484  struct GDError* error);
485 
495 GD_C_API void GDCredential_free(struct GDCredential* credentials, size_t credentialCount);
496 
501 #ifdef __cplusplus
502 }
503 #endif
504 
505 #endif
GDX509Certificate::serialNumber
char * serialNumber
X.509 Serial Number field.
Definition: GDCredential.h:78
GDCredential_importDone
void GDCredential_importDone(void)
Finalize credential import.
GDX509Certificate_subject_relative_name
const char * GDX509Certificate_subject_relative_name(const struct GDX509Certificate *certificate, const char *relative_name)
Return relative name from within a fully-qualified distinguished name of the subject.
GDX509Certificate::alias
char * alias
Alias name of the certificate if from device storage.
Definition: GDCredential.h:157
GDCredential
Definition: GDCredential.h:252
GDX509Certificate::publicKeyMD5
char * publicKeyMD5
MD5 hash of the public key.
Definition: GDCredential.h:87
GDCredential::auxCount
size_t auxCount
The number of auxiliary certificates.
Definition: GDCredential.h:266
GDX509Certificate::extendedKeyUsage
char * extendedKeyUsage
Extended key usage of the certificate.
Definition: GDCredential.h:149
GDCredential_free
void GDCredential_free(struct GDCredential *credentials, size_t credentialCount)
Free a returned credentials buffer.
GDX509Certificate
X.509 Public Key Certificate.
Definition: GDCredential.h:46
GDCredential_find
struct GDCredential * GDCredential_find(const char *issuer, const char *serial)
Find a credential.
GDCommon.h
GDX509Certificate::valid
bool valid
Returns certificate validity.
Definition: GDCredential.h:137
GDX509Certificate::issuer
char * issuer
X.509 Issuer field.
Definition: GDCredential.h:53
GDX509Certificate::subjectAlternativeName
char * subjectAlternativeName
X.509 Subject Alternative Name field.
Definition: GDCredential.h:70
GDX509Certificate::notAfter
time_t notAfter
X.509 Validity: Not After date and time.
Definition: GDCredential.h:130
GDCredential_import
bool GDCredential_import(char **profileId, const struct GDData *credential, const char *password, struct GDError *error)
Import electronic certificate credentials from a PKCS #12 file.
GDX509Certificate_days_until_renewal_due
int GDX509Certificate_days_until_renewal_due(const struct GDX509Certificate *certificate)
Days until the certificate is due for renewal.
GDX509Certificate_free
void GDX509Certificate_free(struct GDX509Certificate *certificate)
Free a certificate.
GDCredential_list
bool GDCredential_list(const char *profileId, size_t *credentialCount, struct GDCredential **credentials, struct GDError *error)
List available credentials for a User Credential Profile.
GDX509Certificate_create
struct GDX509Certificate * GDX509Certificate_create(const struct GDX509 *certificate)
Create a certificate.
GDX509Certificate_issuer_relative_name
const char * GDX509Certificate_issuer_relative_name(const struct GDX509Certificate *certificate, const char *relative_name)
Return relative name from within a fully-qualified distinguished name of the issuer.
GDX509Certificate::subject
char * subject
X.509 Subject field.
Definition: GDCredential.h:61
GDData
Data encapsulation structure.
Definition: GDCommon.h:136
GDX509Certificate::notBefore
time_t notBefore
X.509 Validity: Not Before date and time.
Definition: GDCredential.h:122
GDCredential::auxCertificates
struct GDX509Certificate * auxCertificates
Auxiliary intermediate certificates.
Definition: GDCredential.h:277
GDCredential::userCertificate
struct GDX509Certificate * userCertificate
Leaf certificate.
Definition: GDCredential.h:258
GDCredential_undoImport
bool GDCredential_undoImport(const char *profileId)
Remove all credentials for a given User Credential Profile.
GDError
Error structure.
Definition: GDCommon.h:112
GDCredential_remove_credential
bool GDCredential_remove_credential(const struct GDCredential *credential)
Remove an imported or device credential.
GDCredential_remove
bool GDCredential_remove(const char *issuer, const char *serial)
Remove an imported or device credential.
GDX509Certificate_days_until_expiry
int GDX509Certificate_days_until_expiry(const struct GDX509Certificate *certificate)
Days until the certificate expires.
GDX509Certificate::certificateMD5
char * certificateMD5
MD5 hash of the public key.
Definition: GDCredential.h:105
GDX509Certificate::publicKeySHA1
char * publicKeySHA1
SHA-1 hash of the public key.
Definition: GDCredential.h:96
GDX509Certificate::keyUsage
char * keyUsage
Key usage of the certificate.
Definition: GDCredential.h:143
GDX509Certificate::certificateSHA1
char * certificateSHA1
SHA-1 hash of the certificate.
Definition: GDCredential.h:114