CryptoAuthLib
Microchip CryptoAuthentication Library
atca_helpers.h
Go to the documentation of this file.
1 
28 #ifndef ATCA_HELPERS_H_
29 #define ATCA_HELPERS_H_
30 
31 #include "cryptoauthlib.h"
32 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 ATCA_STATUS atcab_printbin(uint8_t* binary, size_t bin_len, bool add_space);
45 ATCA_STATUS atcab_bin2hex(const uint8_t* bin, size_t bin_size, char* hex, size_t* hex_size);
46 ATCA_STATUS atcab_bin2hex_(const uint8_t* bin, size_t bin_size, char* hex, size_t* hex_size, bool is_pretty);
47 ATCA_STATUS atcab_hex2bin(const char* ascii_hex, size_t ascii_hex_len, uint8_t* binary, size_t* bin_len);
48 ATCA_STATUS atcab_printbin_sp(uint8_t* binary, size_t bin_len);
49 ATCA_STATUS atcab_printbin_label(const char* label, uint8_t* binary, size_t bin_len);
50 
51 
52 ATCA_STATUS packHex(const char* ascii_hex, size_t ascii_hex_len, char* packed_hex, size_t* packed_len);
53 bool isDigit(char c);
54 bool isWhiteSpace(char c);
55 bool isAlpha(char c);
56 bool isHexAlpha(char c);
57 bool isHex(char c);
58 bool isHexDigit(char c);
59 
60 bool isBase64(char c, const uint8_t * rules);
61 bool isBase64Digit(char c, const uint8_t * rules);
62 uint8_t base64Index(char c, const uint8_t * rules);
63 char base64Char(uint8_t id, const uint8_t * rules);
64 
65 extern uint8_t atcab_b64rules_default[4];
66 extern uint8_t atcab_b64rules_mime[4];
67 extern uint8_t atcab_b64rules_urlsafe[4];
68 
69 ATCA_STATUS atcab_base64decode_(const char* encoded, size_t encoded_size, uint8_t* data, size_t* data_size, const uint8_t * rules);
70 ATCA_STATUS atcab_base64decode(const char* encoded, size_t encoded_size, uint8_t* data, size_t* data_size);
71 
72 ATCA_STATUS atcab_base64encode_(const uint8_t* data, size_t data_size, char* encoded, size_t* encoded_size, const uint8_t * rules);
73 ATCA_STATUS atcab_base64encode(const uint8_t* data, size_t data_size, char* encoded, size_t* encoded_size);
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
80 #endif /* ATCA_HELPERS_H_ */
bool isAlpha(char c)
Checks to see if a character is an ASCII representation of hex ((c >= &#39;A&#39;) and (c <= &#39;F&#39;)) || ((c >= ...
Definition: atca_helpers.c:244
bool isWhiteSpace(char c)
Checks to see if a character is whitespace.
Definition: atca_helpers.c:234
ATCA_STATUS atcab_base64encode_(const uint8_t *data, size_t data_size, char *encoded, size_t *encoded_size, const uint8_t *rules)
Encode data as base64 string with ruleset option.
Definition: atca_helpers.c:626
uint8_t base64Index(char c, const uint8_t *rules)
Returns the base 64 index of the given character.
Definition: atca_helpers.c:420
uint8_t atcab_b64rules_urlsafe[4]
Definition: atca_helpers.c:43
ATCA_STATUS atcab_printbin_label(const char *label, uint8_t *binary, size_t bin_len)
bool isDigit(char c)
Checks to see if a character is an ASCII representation of a digit ((c ge &#39;0&#39;) and (c le &#39;9&#39;)) ...
Definition: atca_helpers.c:224
char base64Char(uint8_t id, const uint8_t *rules)
Returns the base 64 character of the given index.
Definition: atca_helpers.c:455
ATCA_STATUS atcab_base64decode(const char *encoded, size_t encoded_size, uint8_t *data, size_t *data_size)
Decode base64 string to data.
Definition: atca_helpers.c:757
ATCA_STATUS atcab_printbin_sp(uint8_t *binary, size_t bin_len)
ATCA_STATUS
Definition: atca_status.h:41
uint8_t atcab_b64rules_mime[4]
Definition: atca_helpers.c:42
ATCA_STATUS atcab_base64encode(const uint8_t *data, size_t data_size, char *encoded, size_t *encoded_size)
Encode data as base64 string.
Definition: atca_helpers.c:741
Single aggregation point for all CryptoAuthLib header files.
bool isBase64(char c, const uint8_t *rules)
Returns true if this character is a valid base 64 character or if this is whitespace (A character can...
Definition: atca_helpers.c:398
ATCA_STATUS atcab_hex2bin(const char *ascii_hex, size_t ascii_hex_len, uint8_t *binary, size_t *bin_len)
Function that converts a hex string to binary buffer.
Definition: atca_helpers.c:179
bool isBase64Digit(char c, const uint8_t *rules)
Returns true if this character is a valid base 64 character.
Definition: atca_helpers.c:409
bool isHexAlpha(char c)
Checks to see if a character is an ASCII representation of hex ((c >= &#39;A&#39;) and (c <= &#39;F&#39;)) || ((c >= ...
Definition: atca_helpers.c:254
ATCA_STATUS atcab_printbin(uint8_t *binary, size_t bin_len, bool add_space)
ATCA_STATUS atcab_base64decode_(const char *encoded, size_t encoded_size, uint8_t *data, size_t *data_size, const uint8_t *rules)
Decode base64 string to data with ruleset option.
Definition: atca_helpers.c:548
ATCA_STATUS atcab_bin2hex_(const uint8_t *bin, size_t bin_size, char *hex, size_t *hex_size, bool is_pretty)
Function that converts a binary buffer to a hex string suitable for easy reading. ...
Definition: atca_helpers.c:93
uint8_t atcab_b64rules_default[4]
Definition: atca_helpers.c:41
ATCA_STATUS packHex(const char *ascii_hex, size_t ascii_hex_len, char *packed_hex, size_t *packed_len)
Remove white space from a ASCII hex string.
Definition: atca_helpers.c:289
bool isHexDigit(char c)
Returns true if this character is a valid hex character.
Definition: atca_helpers.c:275
ATCA_STATUS atcab_bin2hex(const uint8_t *bin, size_t bin_size, char *hex, size_t *hex_size)
Convert a binary buffer to a hex string for easy reading.
Definition: atca_helpers.c:54
bool isHex(char c)
Returns true if this character is a valid hex character or if this is whitespace (The character can b...
Definition: atca_helpers.c:265