Couchbase Lite C
Couchbase Lite C API
Data Structures
CBLTLSIdentity.h File Reference
#include "CBLBase.h"

Go to the source code of this file.

Data Structures

struct  CBLExternalKeyCallbacks
 Callbacks for performing cryptographic operations with an externally managed key pair. More...
 

RSA Key-pair

enum  CBLSignatureDigestAlgorithm : int {
  kCBLSignatureDigestNone = 0 , kCBLSignatureDigestSHA1 = 4 , kCBLSignatureDigestSHA224 , kCBLSignatureDigestSHA256 ,
  kCBLSignatureDigestSHA384 , kCBLSignatureDigestSHA512 , kCBLSignatureDigestRIPEMD160
}
 Digest algorithms to be used when generating signatures with a private key. More...
 
_cbl_warn_unused CBLKeyPair *_cbl_nullable CBLKeyPair_CreateWithExternalKey (size_t keySizeInBits, void *externalKey, CBLExternalKeyCallbacks callbacks, CBLError *_cbl_nullable outError)
 Returns an RSA key pair object that wraps an external key pair managed by application code. More...
 
_cbl_warn_unused CBLKeyPair *_cbl_nullable CBLKeyPair_CreateWithPrivateKeyData (FLSlice privateKeyData, FLSlice passwordOrNull, CBLError *_cbl_nullable outError)
 Creates an RSA KeyPair from private key data in PEM or DER format. More...
 
_cbl_warn_unused FLSliceResult CBLKeyPair_PublicKeyDigest (CBLKeyPair *keyPair)
 Returns a hex-encoded digest of the public key. More...
 
_cbl_warn_unused FLSliceResult CBLKeyPair_PublicKeyData (CBLKeyPair *keyPair)
 Returns the public key data. More...
 
_cbl_warn_unused FLSliceResult CBLKeyPair_PrivateKeyData (CBLKeyPair *keyPair)
 Returns the private key data, if the private key is known and its data is accessible. More...
 

TLS Identity

enum  CBLKeyUsages : uint16_t { kCBLKeyUsagesClientAuth = 0x80 , kCBLKeyUsagesServerAuth = 0x40 }
 Defines key usage options for creating self-signed TLS identities. More...
 
typedef struct CBLTLSIdentity CBLTLSIdentity
 An opaque object representing the TLSIdentity. More...
 
static const CBLTLSIdentityCBLTLSIdentity_Retain (const CBLTLSIdentity *t)
 
static void CBLTLSIdentity_Release (const CBLTLSIdentity *t)
 
_cbl_warn_unused CBLCertCBLTLSIdentity_Certificates (CBLTLSIdentity *identity)
 Returns the certificate chain associated with the given TLS identity. More...
 
CBLTimestamp CBLTLSIdentity_Expiration (CBLTLSIdentity *identity)
 Returns the date/time at which the first certificate in the chain expires. More...
 
_cbl_warn_unused CBLTLSIdentity *_cbl_nullable CBLTLSIdentity_CreateIdentity (CBLKeyUsages keyUsages, FLDict attributes, CBLTimestamp expiration, FLString label, CBLError *_cbl_nullable outError)
 Creates a self-signed TLS identity using the specified certificate attributes. More...
 
_cbl_warn_unused CBLTLSIdentity *_cbl_nullable CBLTLSIdentity_CreateIdentityWithKeyPair (CBLKeyUsages keyUsages, CBLKeyPair *keypair, FLDict attributes, CBLTimestamp expiration, CBLError *_cbl_nullable outError)
 Creates a self-signed TLS identity using the provided RSA key pair and certificate attributes. More...
 
bool CBLTLSIdentity_DeleteIdentityWithLabel (FLString label, CBLError *_cbl_nullable outError)
 Deletes the TLS identity associated with the given persistent label from the platform's keystore (Keychain on Apple platforms or CNG Key Storage Provider on Windows). More...
 
_cbl_warn_unused CBLTLSIdentity *_cbl_nullable CBLTLSIdentity_IdentityWithLabel (FLString label, CBLError *_cbl_nullable outError)
 Retrieves a TLS identity associated with the given persistent label from the platform's keystore (Keychain on Apple platforms or CNG Key Storage Provider on Windows). More...
 
_cbl_warn_unused CBLTLSIdentity *_cbl_nullable CBLTLSIdentity_IdentityWithKeyPairAndCerts (CBLKeyPair *keypair, CBLCert *cert, CBLError *_cbl_nullable outError)
 Returns a TLS identity from an existing identity using the provided RSA keypair and certificate. More...
 
_cbl_warn_unused CBLTLSIdentity *_cbl_nullable CBLTLSIdentity_IdentityWithCerts (CBLCert *cert, CBLError *_cbl_nullable outError)
 Returns an existing TLS identity associated with the provided certificate chain in the keystore (Keychain for Apple or CNG Key Storage Provider for Windows). More...
 

X.509 Certificates

typedef struct CBLCert CBLCert
 An opaque object representing the X.509 Certifcate. More...
 
typedef struct CBLKeyPair CBLKeyPair
 An opaque object representing the key pair. More...
 
CBL_PUBLIC const FLString kCBLCertAttrKeyCommonName
 
CBL_PUBLIC const FLString kCBLCertAttrKeyPseudonym
 
CBL_PUBLIC const FLString kCBLCertAttrKeyGivenName
 
CBL_PUBLIC const FLString kCBLCertAttrKeySurname
 
CBL_PUBLIC const FLString kCBLCertAttrKeyOrganization
 
CBL_PUBLIC const FLString kCBLCertAttrKeyOrganizationUnit
 
CBL_PUBLIC const FLString kCBLCertAttrKeyPostalAddress
 
CBL_PUBLIC const FLString kCBLCertAttrKeyLocality
 
CBL_PUBLIC const FLString kCBLCertAttrKeyPostalCode
 
CBL_PUBLIC const FLString kCBLCertAttrKeyStateOrProvince
 
CBL_PUBLIC const FLString kCBLCertAttrKeyCountry
 
CBL_PUBLIC const FLString kCBLCertAttrKeyEmailAddress
 
CBL_PUBLIC const FLString kCBLCertAttrKeyHostname
 
CBL_PUBLIC const FLString kCBLCertAttrKeyURL
 
CBL_PUBLIC const FLString kCBLCertAttrKeyIPAddress
 
CBL_PUBLIC const FLString kCBLCertAttrKeyRegisteredID
 
static const CBLCertCBLCert_Retain (const CBLCert *t)
 
static void CBLCert_Release (const CBLCert *t)
 
static const CBLKeyPairCBLKeyPair_Retain (const CBLKeyPair *t)
 
static void CBLKeyPair_Release (const CBLKeyPair *t)
 
_cbl_warn_unused CBLCert *_cbl_nullable CBLCert_CreateWithData (FLSlice certData, CBLError *_cbl_nullable outError)
 Creates a CBLCert from X.509 certificate data in DER or PEM format. More...
 
_cbl_warn_unused CBLCert *_cbl_nullable CBLCert_CertNextInChain (CBLCert *cert)
 Gets the next certificate in the chain if presents. More...
 
_cbl_warn_unused FLSliceResult CBLCert_Data (CBLCert *cert, bool pemEncoded)
 Returns the X.509 certificate data in either DER or PEM format. More...
 
_cbl_warn_unused FLSliceResult CBLCert_SubjectName (CBLCert *cert)
 Returns the certificate's Subject Name, which identifies the cert's owner. More...
 
_cbl_warn_unused FLSliceResult CBLCert_SubjectNameComponent (CBLCert *cert, FLString attributeKey)
 Returns a component of the certificate's subject name that matches the specified attribute key. More...
 
void CBLCert_ValidTimespan (CBLCert *cert, CBLTimestamp *_cbl_nullable outCreated, CBLTimestamp *_cbl_nullable outExpires)
 Returns the time range during which a certificate is valid. More...
 
_cbl_warn_unused CBLKeyPairCBLCert_PublicKey (CBLCert *)
 Returns a certificate's public key. More...