]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/emv/emvjson.c
cleaning up iclass.c and optimized_cipher.c
[proxmark3-svn] / client / emv / emvjson.c
index e56ecbb71dbe95c0d7f00e38e267fa4182048a24..116e16da1aba34b6e3814a2ab0af46cbb9365b3d 100644 (file)
@@ -264,6 +264,23 @@ bool HexToBuffer(const char *errormsg, const char *hexvalue, uint8_t * buffer, s
        return true;
 }
 
+int JsonLoadStr(json_t *root, char *path, char *value) {
+       if (!value)
+               return 1;
+
+       json_t *jelm = json_path_get((const json_t *)root, path);
+       if (!jelm || !json_is_string(jelm))
+               return 2;
+       
+       const char * strval = json_string_value(jelm);
+       if (!strval)
+               return 1;
+       
+       memcpy(value, strval, strlen(strval));
+       
+       return 0;
+}
+
 int JsonLoadBufAsHex(json_t *elm, char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen) {
        if (datalen)
                *datalen = 0;
Impressum, Datenschutz