Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-cellframe
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
python-cellframe
Commits
c030c8a2
Commit
c030c8a2
authored
5 years ago
by
alexey.stratulat
Browse files
Options
Downloads
Patches
Plain Diff
[+] Made a test to check the implementation of base64 wrapping
parent
5f01efc9
No related branches found
Branches containing commit
No related tags found
1 merge request
!26
Support 3689
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/key_list.h
+10
-2
10 additions, 2 deletions
include/key_list.h
include/libdap-crypto-python.h
+3
-1
3 additions, 1 deletion
include/libdap-crypto-python.h
include/wrapping_dap_enc_key.h
+9
-1
9 additions, 1 deletion
include/wrapping_dap_enc_key.h
test/test_b64.py
+24
-0
24 additions, 0 deletions
test/test_b64.py
with
46 additions
and
4 deletions
include/key_list.h
+
10
−
2
View file @
c030c8a2
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
#include
<stdint.h>
#include
<stdint.h>
#include
<string.h>
#include
<string.h>
#ifdef __cplusplus
extern
"C"
{
#endif
#undef LOG_TAG
#undef LOG_TAG
#define LOG_TAG "key-list"
#define LOG_TAG "key-list"
...
@@ -11,8 +15,12 @@ typedef struct key_list{
...
@@ -11,8 +15,12 @@ typedef struct key_list{
uint8_t
lenght
;
uint8_t
lenght
;
}
key_list_t
;
}
key_list_t
;
key_list_t
*
key_list_init
();
key_list_t
*
key_list_init
(
void
);
void
key_list_free
(
key_list_t
*
list
);
void
key_list_free
(
key_list_t
*
list
);
uint8_t
key_list_add_element
(
key_list_t
*
list
,
dap_enc_key_t
*
key
);
uint8_t
key_list_add_element
(
key_list_t
*
list
,
dap_enc_key_t
*
key
);
bool
key_list_del_element
(
key_list_t
*
list
,
uint8_t
key
);
bool
key_list_del_element
(
key_list_t
*
list
,
uint8_t
key
);
dap_enc_key_t
*
key_list_get_key
(
key_list_t
*
list
,
uint8_t
key
);
dap_enc_key_t
*
key_list_get_key
(
key_list_t
*
list
,
uint8_t
key
);
\ No newline at end of file
#ifdef __cplusplus
}
#endif
This diff is collapsed.
Click to expand it.
include/libdap-crypto-python.h
+
3
−
1
View file @
c030c8a2
...
@@ -33,6 +33,8 @@ static PyMethodDef DapCryptoMethods[] = {
...
@@ -33,6 +33,8 @@ static PyMethodDef DapCryptoMethods[] = {
{
"logItInfo"
,
dap_log_it_info
,
METH_VARARGS
,
""
},
{
"logItInfo"
,
dap_log_it_info
,
METH_VARARGS
,
""
},
{
"newKey"
,
dap_enc_key_new_py
,
METH_VARARGS
,
"The function creates a new key, and returns it with PyObject."
},
{
"newKey"
,
dap_enc_key_new_py
,
METH_VARARGS
,
"The function creates a new key, and returns it with PyObject."
},
{
"delKey"
,
dap_enc_key_delete_py
,
METH_VARARGS
,
""
},
{
"delKey"
,
dap_enc_key_delete_py
,
METH_VARARGS
,
""
},
{
"getEncSizeKey"
,
dap_enc_key_get_enc_size_py
,
METH_VARARGS
,
""
},
{
"getDecSizeKey"
,
dap_enc_key_get_dec_size_py
,
METH_VARARGS
,
""
},
{
NULL
,
NULL
,
0
,
NULL
}
{
NULL
,
NULL
,
0
,
NULL
}
};
};
...
@@ -49,4 +51,4 @@ PyMODINIT_FUNC PyInit_libdap_crypto_python_module(void);
...
@@ -49,4 +51,4 @@ PyMODINIT_FUNC PyInit_libdap_crypto_python_module(void);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
include/wrapping_dap_enc_key.h
+
9
−
1
View file @
c030c8a2
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
#include
"dap_common.h"
#include
"dap_common.h"
#include
"key_list.h"
#include
"key_list.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#undef LOG_TAG
#undef LOG_TAG
#define LOG_TAG "wrapping-dap-enc-key"
#define LOG_TAG "wrapping-dap-enc-key"
...
@@ -32,4 +36,8 @@ PyObject *dap_enc_gen_key_public_size_py(PyObject *self, PyObject *args);//dap_e
...
@@ -32,4 +36,8 @@ PyObject *dap_enc_gen_key_public_size_py(PyObject *self, PyObject *args);//dap_e
PyObject
*
dap_enc_gen_key_public_py
(
PyObject
*
self
,
PyObject
*
args
);
//dap_enc_key_t *a_key, void * a_output); ->int
PyObject
*
dap_enc_gen_key_public_py
(
PyObject
*
self
,
PyObject
*
args
);
//dap_enc_key_t *a_key, void * a_output); ->int
PyObject
*
dap_enc_key_signature_delete_py
(
PyObject
*
self
,
PyObject
*
args
);
//dap_enc_key_type_t a_key_type, uint8_t *a_sig_buf); ->void
PyObject
*
dap_enc_key_signature_delete_py
(
PyObject
*
self
,
PyObject
*
args
);
//dap_enc_key_type_t a_key_type, uint8_t *a_sig_buf); ->void
PyObject
*
dap_enc_key_delete_py
(
PyObject
*
self
,
PyObject
*
args
);
//dap_enc_key_t * a_key); ->void
PyObject
*
dap_enc_key_delete_py
(
PyObject
*
self
,
PyObject
*
args
);
//dap_enc_key_t * a_key); ->void
\ No newline at end of file
#ifdef __cplusplus
}
#endif
This diff is collapsed.
Click to expand it.
test/test_b64.py
0 → 100644
+
24
−
0
View file @
c030c8a2
import
libdap_crypto_python_module
as
crypto
print
(
"
Start test crypto b64
"
)
s
=
"
Test! I will crush Base64!
"
print
(
"
Input data:
"
+
s
)
crypt
=
crypto
.
encodeBase64
(
bytes
(
s
,
"
utf-8
"
),
1
)
print
(
"
Encrypted data:
\t
"
)
print
(
crypt
)
decrypt
=
crypto
.
decodeBase64
(
crypt
,
1
)
print
(
"
Decoded data:
\t
"
)
print
(
decrypt
)
if
bytes
(
s
,
"
utf-8
"
)
==
decrypt
:
print
(
"
TEST 1. Encode/Decode base64 done
"
)
else
:
print
(
"
TEST 1. Encode/Decode base64 faild
"
)
print
(
"
Test Base64 URLSAFE
"
)
u
=
"
http://kelvin.foundation/
"
crypt_u
=
crypto
.
encodeBase64
(
bytes
(
u
,
"
utf-8
"
),
2
)
decrypt_u
=
crypto
.
decodeBase64
(
crypt_u
)
if
bytes
(
u
,
"
utf-8
"
)
==
decrypt_u
:
print
(
"
TEST 2. Encode/Decode base64 urlsafe done
"
)
else
:
print
(
"
TEST 2. Encode/Decode base64 urlsafe faild
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment