]>
git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/dnssec_v2/utilities/base_encoding/base_n.h
5 // Copyright (c) 2020 Apple Inc. All rights reserved.
11 #pragma mark - Includes
12 #include "mDNSEmbeddedAPI.h"
14 #if MDNSRESPONDER_SUPPORTS(APPLE, DNSSECv2)
22 #pragma mark base_n_encode
25 * Gets the Base N encoding for the binary data
28 * The base we would like to convert, currently it could be Base 64 or Base 32.
31 * The data that needs to be encoded.
34 * The length of the data that needs to be encoded..
37 * This function returns a malloced string that needs to be freed by the caller.
40 base_n_encode(base_n_t base_n
, const unsigned char * _Nonnull data
, size_t data_len
);
42 #pragma mark base_n_encode_ex
45 * Gets the Base N encoding for the binary data, and return the length of the encoding string.
48 * The base we would like to convert, currently it could be Base 64 or Base 32.
51 * The data that needs to be encoded.
54 * The length of the data that needs to be encoded.
57 * The output pointer to the length of the encoded string.
60 * This function returns a malloced string that needs to be freed by the caller, and also the length of encoded string.
63 base_n_encode_ex(base_n_t base_n
, const unsigned char * _Nonnull data
, size_t data_len
, size_t * const _Nullable out_str_len
);
65 #pragma mark get_base_n_encoded_str_length
68 * Gets the length of the encoded string after Base N encoding
71 * The base we would like to convert, currently it could be DNSSEC_BASE_64 or DNSSEC_BASE_32_HEX.
74 * The length of the data that needs to be encoded.
77 * The length does not include the '\0'.
80 get_base_n_encoded_str_length(base_n_t base_n
, size_t data_len
) ;
82 #endif // MDNSRESPONDER_SUPPORTS(APPLE, DNSSECv2)