@@ -69,7 +69,7 @@ CBL_PUBLIC extern const FLString kCBLCertAttrKeySurname; // "SN",
6969CBL_PUBLIC extern const FLString kCBLCertAttrKeyOrganization ; // "O", e.g. "Example Corp."
7070CBL_PUBLIC extern const FLString kCBLCertAttrKeyOrganizationUnit ; // "OU", e.g. "Marketing"
7171CBL_PUBLIC extern const FLString kCBLCertAttrKeyPostalAddress ; // "postalAddress", e.g. "123 Example Blvd #2A"
72- CBL_PUBLIC extern const FLString kCBLCertAttrKeyLocality ; // "locality", e.g. "Boston"
72+ CBL_PUBLIC extern const FLString kCBLCertAttrKeyLocality ; // "L", e.g. "Boston"
7373CBL_PUBLIC extern const FLString kCBLCertAttrKeyPostalCode ; // "postalCode", e.g. "02134"
7474CBL_PUBLIC extern const FLString kCBLCertAttrKeyStateOrProvince ; // "ST", e.g. "Massachusetts" (or "Quebec", ...)
7575CBL_PUBLIC extern const FLString kCBLCertAttrKeyCountry ; // "C", e.g. "us" (2-letter ISO country code)
@@ -79,7 +79,7 @@ CBL_PUBLIC extern const FLString kCBLCertAttrKeyEmailAddress; // "rfc822Nam
7979CBL_PUBLIC extern const FLString kCBLCertAttrKeyHostname ; // "dNSName", e.g. "www.example.com"
8080CBL_PUBLIC extern const FLString kCBLCertAttrKeyURL ; // "uniformResourceIdentifier", e.g. "https://example.com/jane"
8181CBL_PUBLIC extern const FLString kCBLCertAttrKeyIPAddress ; // "iPAddress", e.g. An IP Address in binary format e.g. "\x0A\x00\x01\x01"
82- CBL_PUBLIC extern const FLString kCBLCertAttrKeyRegisteredID ; // "registeredID", e.g. A domain specific identifier.
82+ CBL_PUBLIC extern const FLString kCBLCertAttrKeyRegisteredID ; // "registeredID", e.g. A domain- specific identifier encoded as an ASN.1 Object Identifier (OID) in DER format .
8383
8484/* * An opaque object representing the X.509 Certifcate. */
8585typedef struct CBLCert CBLCert;
@@ -168,7 +168,8 @@ typedef CBL_ENUM(int, CBLSignatureDigestAlgorithm) {
168168 The core idea is that all private key operations are delegated to the application's secure key storage,
169169 ensuring that the private key is never exposed outside the key storage. */
170170typedef struct CBLExternalKeyCallbacks {
171- /* * Provides the public key's raw data, as an ASN.1 DER sequence of [modulus, exponent].
171+ /* * Provides the public key data as an ASN.1 DER-encoded SubjectPublicKeyInfo structure.
172+ For more information, see RFC 5280: https://datatracker.ietf.org/doc/html/rfc5280
172173 @param externalKey The external key pointer given to CBLKeyPair_CreateWithExternalKey.
173174 @param output Where to copy the key data.
174175 @param outputMaxLen Maximum length of output that can be written.
@@ -237,18 +238,20 @@ CBLKeyPair* _cbl_nullable CBLKeyPair_CreateWithPrivateKeyData(FLSlice privateKey
237238/* * Returns a hex-encoded digest of the public key.
238239 @param keyPair The key pair from which to extract the public key digest.
239240 @return A hex-encoded digest of the public key.
241+ @note Returns empty result if the public key digest cannot be retrieved.
240242 @note You are responsible for releasing the returned data. */
241243_cbl_warn_unused
242244FLSliceResult CBLKeyPair_PublicKeyDigest (CBLKeyPair* keyPair) CBLAPI;
243245
244246/* * Returns the public key data.
245247 @param keyPair The key pair from which to retrieve the public key.
246248 @return The public key data.
249+ @note Returns empty result if the public key data cannot be retrieved.
247250 @note You are responsible for releasing the returned data. */
248251_cbl_warn_unused
249252FLSliceResult CBLKeyPair_PublicKeyData (CBLKeyPair* keyPair) CBLAPI;
250253
251- /* * Returns the private key data, if the private key is known and its data is accessible.
254+ /* * Returns the private key data in DER format , if the private key is known and its data is accessible.
252255 @param keyPair The key pair containing the private key.
253256 @return The private key data, or an empty slice if the key is not accessible.
254257 @note Persistent private keys in the secure key store generally don't have accessible data.
@@ -293,7 +296,7 @@ typedef CBL_OPTIONS(uint16_t, CBLKeyUsages) {
293296 the platform's secure key store (Keychain on Apple platforms or CNG Key Storage Provider on Windows).
294297 @param keyUsages The key usages for the generated identity.
295298 @param attributes A dictionary containing the certificate attributes.
296- @param expiration The expiration date/time of the certificate in the identity .
299+ @param validityInMilliseconds Certificate validity duration in milliseconds .
297300 @param label The label used for persisting the identity in the platform's secure storage. If `kFLSliceNull` is passed, the identity will not be persisted.
298301 @param outError On failure, the error will be written here.
299302 @return A CBLTLSIdentity instance on success, or NULL on failure.
@@ -303,15 +306,15 @@ typedef CBL_OPTIONS(uint16_t, CBLKeyUsages) {
303306_cbl_warn_unused
304307CBLTLSIdentity* _cbl_nullable CBLTLSIdentity_CreateIdentity (CBLKeyUsages keyUsages,
305308 FLDict attributes,
306- CBLTimestamp expiration ,
309+ int64_t validityInMilliseconds ,
307310 FLString label,
308311 CBLError* _cbl_nullable outError) CBLAPI;
309312
310313/* * Creates a self-signed TLS identity using the provided RSA key pair and certificate attributes.
311314 @param keyUsages The key usages for the generated identity.
312315 @param keypair The RSA key pair to be used for generating the TLS identity.
313316 @param attributes A dictionary containing the certificate attributes.
314- @param expiration The expiration date/time of the certificate in the identity .
317+ @param validityInMilliseconds Certificate validity duration in milliseconds .
315318 @param outError On failure, the error will be written here.
316319 @return A CBLTLSIdentity instance on success, or NULL on failure.
317320 @Note The Common Name (kCBLCertAttrKeyCommonName) attribute is required.
@@ -320,7 +323,7 @@ _cbl_warn_unused
320323CBLTLSIdentity* _cbl_nullable CBLTLSIdentity_CreateIdentityWithKeyPair (CBLKeyUsages keyUsages,
321324 CBLKeyPair* keypair,
322325 FLDict attributes,
323- CBLTimestamp expiration ,
326+ int64_t validityInMilliseconds ,
324327 CBLError* _cbl_nullable outError) CBLAPI;
325328
326329#if !defined(__linux__) && !defined(__ANDROID__)
@@ -348,10 +351,10 @@ CBLTLSIdentity* _cbl_nullable CBLTLSIdentity_IdentityWithLabel(FLString label,
348351
349352#endif // #if !defined(__linux__) && !defined(__ANDROID__)
350353
351- /* * Returns a TLS identity from an existing identity using the provided RSA keypair and certificate.
352- * The certificate will not be resigned with the new keypair; it will be used as is .
354+ /* * Returns a TLS identity from an existing identity using the provided RSA keypair and certificate chain .
355+ * The certificate chain is used as-is; the leaf certificate is not re-signed .
353356 * @param keypair A CBLKeyPair instance representing the RSA keypair to be associated with the identity.
354- * @param cert A CBLCert instance representing the certificate associated with the identity .
357+ * @param cert A CBLCert instance representing the certificate chain .
355358 * @param outError On failure, the error will be written here.
356359 * @return A CBLTLSIdentity instance on success, or `NULL` if an error occurs.
357360 @note You are responsible for releasing the returned reference. */
0 commit comments