• BlackBerry Dynamics
  • Runtime library for iOS applications
  • 12.0.1.79
GDCredential.h
Go to the documentation of this file.
1 /*
2  * Copyright 2023 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 
48 struct GD_C_API GDX509Certificate {
55  char* issuer;
56 
63  char* subject;
64 
73 
80  char* serialNumber;
81 
89  char* publicKeyMD5;
90 
99 
108 
117 
124  time_t notBefore;
125 
132  time_t notAfter;
133 
139  bool valid;
140 
145  char* keyUsage;
146 
152 
159  char* alias;
160 
166  struct GDData x509;
167 };
168 
172 struct GD_C_API GDX509;
173 
183 GD_C_API struct GDX509Certificate* GDX509Certificate_create(const struct GDX509* certificate);
184 
191 GD_C_API void GDX509Certificate_free(struct GDX509Certificate* certificate);
192 
201 GD_C_API int GDX509Certificate_days_until_expiry(const struct GDX509Certificate* certificate);
202 
213 GD_C_API int GDX509Certificate_days_until_renewal_due(const struct GDX509Certificate* certificate);
214 
229 GD_C_API const char* GDX509Certificate_issuer_relative_name(const struct GDX509Certificate* certificate, const char* relative_name);
230 
245 GD_C_API const char* GDX509Certificate_subject_relative_name(const struct GDX509Certificate* certificate, const char* relative_name);
246 
247 
257 struct GD_C_API GDCredential {
264 
271  size_t auxCount;
272 
283 };
284 
366  GD_C_API bool GDCredential_import(char** profileId,
367  const struct GDData* credential,
368  const char* password,
369  struct GDError* error);
370 
419  GD_C_API bool GDCredential_importPEM(char** profileId,
420  const struct GDData* credential,
421  const char* password,
422  struct GDError* error);
423 
435 GD_C_API void GDCredential_importDone(void);
436 
450 GD_C_API bool GDCredential_undoImport(const char* profileId);
451 
463 GD_C_API struct GDCredential* GDCredential_find(const char* issuer, const char* serial);
464 
475 GD_C_API bool GDCredential_remove_credential(const struct GDCredential* credential);
476 
488 GD_C_API bool GDCredential_remove(const char* issuer, const char* serial);
489 
539 GD_C_API bool GDCredential_list(const char* profileId,
540  size_t* credentialCount,
541  struct GDCredential** credentials,
542  struct GDError* error);
543 
553 GD_C_API void GDCredential_free(struct GDCredential* credentials, size_t credentialCount);
554 
559 #ifdef __cplusplus
560 }
561 #endif
562 
563 #endif
GDX509Certificate::serialNumber
char * serialNumber
X.509 Serial Number field.
Definition: GDCredential.h:80
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:159
GDCredential
Definition: GDCredential.h:257
GDX509Certificate::publicKeyMD5
char * publicKeyMD5
MD5 hash of the public key.
Definition: GDCredential.h:89
GDCredential::auxCount
size_t auxCount
The number of auxiliary certificates.
Definition: GDCredential.h:271
GDX509Certificate::extendedKeyUsage
char * extendedKeyUsage
Extended key usage of the certificate.
Definition: GDCredential.h:151
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:48
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:139
GDX509Certificate::issuer
char * issuer
X.509 Issuer field.
Definition: GDCredential.h:55
GDX509Certificate::subjectAlternativeName
char * subjectAlternativeName
X.509 Subject Alternative Name field.
Definition: GDCredential.h:72
GDX509Certificate::notAfter
time_t notAfter
X.509 Validity: Not After date and time.
Definition: GDCredential.h:132
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:63
GDData
Data encapsulation structure.
Definition: GDCommon.h:140
GDX509Certificate::notBefore
time_t notBefore
X.509 Validity: Not Before date and time.
Definition: GDCredential.h:124
GDCredential::auxCertificates
struct GDX509Certificate * auxCertificates
Auxiliary intermediate certificates.
Definition: GDCredential.h:282
GDCredential::userCertificate
struct GDX509Certificate * userCertificate
Leaf certificate.
Definition: GDCredential.h:263
GDCredential_importPEM
bool GDCredential_importPEM(char **profileId, const struct GDData *credential, const char *password, struct GDError *error)
Import electronic certificate credentials from a PEM container.
GDCredential_undoImport
bool GDCredential_undoImport(const char *profileId)
Remove all credentials for a given User Credential Profile.
GDError
Error structure.
Definition: GDCommon.h:114
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:107
GDX509Certificate::publicKeySHA1
char * publicKeySHA1
SHA-1 hash of the public key.
Definition: GDCredential.h:98
GDX509Certificate::keyUsage
char * keyUsage
Key usage of the certificate.
Definition: GDCredential.h:145
GDX509Certificate::certificateSHA1
char * certificateSHA1
SHA-1 hash of the certificate.
Definition: GDCredential.h:116