Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
yids
avr-pager
Commits
6719363a
Commit
6719363a
authored
Dec 07, 2015
by
hark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save keys
parent
8fa05907
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
11 deletions
+41
-11
README
README
+11
-0
base-tx/packets.h
base-tx/packets.h
+4
-10
base-tx/test.c
base-tx/test.c
+26
-1
No files found.
README
View file @
6719363a
...
...
@@ -6,6 +6,17 @@ to try it out:
apt-get install arduino arduino-mk
- get the required libraries from https://gitlab.net.020wireless.nl/yids/arduino-build
- in base-tx there is test.c, it is a test for the messages
possible ways to get the message to the pager:
- udp packets to open wifi ap
- multicast on lorawan
- own transmitter
- iridium paging system
- udp packets via sattelite with a not encrypted dvb-ip downlink
some things on ECC:
http://www.infosecwriters.com/Papers/Anoopms_ECC.pdf
...
...
base-tx/packets.h
View file @
6719363a
...
...
@@ -10,21 +10,15 @@ struct keypair
uint8_t
compressed_point
[
33
];
};
struct
pagermessage
{
//Will be filled in with the compressed public key. Must be at least
// (curve size + 1) bytes long; for example, if the curve is secp256r1,
// compressed must be 33 bytes long.
struct
pagermessage
{
uint8_t
sender_compressed_point
[
33
];
// address is SHA1 hash of publickey
//int address;
// maybe use 7bit ascii, or even smaller characters (only letters + numbers)
char
msg
[
128
];
//unsigned char key[32];
unsigned
char
iv
[
16
];
unsigned
char
iv
[
16
];
};
/* subjectPublicKeyInfo field
...
...
base-tx/test.c
View file @
6719363a
...
...
@@ -97,7 +97,15 @@ struct pagermessage * send_message(struct keypair *to, struct keypair *from, c
*/
// dump_buffer(sizeof(struct pagermessage), msg);
return
msg
;
char
to_base64
[
sizeof
(
struct
keypair
)];
base64_encode
(
&
to_base64
,
to
,
sizeof
(
struct
keypair
));
printf
(
"
\n
to (keypair): len: %u base64:
\n
%129.129s
\n
"
,
sizeof
(
struct
keypair
)
,
to_base64
,
to
);
char
msg_base64
[
sizeof
(
struct
pagermessage
)];
base64_encode
(
&
msg_base64
,
msg
,
sizeof
(
struct
pagermessage
));
printf
(
"
\n
encmsg: len: %u base64:
\n
%177.177s
\n
"
,
sizeof
(
struct
pagermessage
)
,
msg_base64
,
msg
);
return
msg
;
}
void
receive_message
(
struct
keypair
*
me
,
struct
pagermessage
*
msg
)
{
...
...
@@ -155,6 +163,21 @@ struct keypair * create_keypair() {
return
keypair
;
}
save_key
(
struct
keypair
*
key
,
char
*
filename
)
{
FILE
*
f
;
f
=
fopen
(
filename
,
"w"
);
fwrite
(
key
,
1
,
sizeof
(
struct
keypair
),
f
);
fclose
(
f
);
}
load_key
(
struct
keypair
*
key
,
char
*
filename
)
{
FILE
*
f
;
f
=
fopen
(
filename
,
"r"
);
fread
(
key
,
1
,
sizeof
(
struct
keypair
),
f
);
fclose
(
f
);
}
void
pb
(
char
buf
)
{
}
...
...
@@ -185,7 +208,9 @@ int main() {
struct
pagermessage
*
sended_msg
;
/* create keypairs */
sender
=
create_keypair
();
save_key
(
sender
,
"sender.keypair"
);
receiver
=
create_keypair
();
save_key
(
receiver
,
"receiver.keypair"
);
sended_msg
=
send_message
(
receiver
,
sender
,
clear_message
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment