-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_test.cpp
More file actions
37 lines (33 loc) · 934 Bytes
/
debug_test.cpp
File metadata and controls
37 lines (33 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "utils/Base64.hh"
#include <iostream>
int main() {
std::string json_spec = R"({
"spec": {
"signature": {
"content": "test-signature"
},
"x509CertificateChain": {
"certificates": [
{
"rawBytes": "dGVzdC1jZXJ0aWZpY2F0ZQ=="
}
]
},
"data": {
"hash": {
"algorithm": "sha256",
"value": "dGVzdC1oYXNo"
}
}
}
})";
std::string encoded = unfold::utils::Base64::encode(json_spec);
std::cout << "Encoded: " << encoded << std::endl;
try {
std::string decoded = unfold::utils::Base64::decode(encoded);
std::cout << "Decoded successfully: " << decoded.substr(0, 50) << "..." << std::endl;
} catch (const std::exception& e) {
std::cout << "Decode failed: " << e.what() << std::endl;
}
return 0;
}