From 7b121971740bb388c8c4a3c77d6c71f7da1cd0d4 Mon Sep 17 00:00:00 2001 From: Fin Date: Fri, 22 Mar 2024 09:18:34 +0800 Subject: [PATCH] update docs --- docs/encryption.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/encryption.md b/docs/encryption.md index d83be17..786aa58 100644 --- a/docs/encryption.md +++ b/docs/encryption.md @@ -19,9 +19,10 @@ deviceKey='F5u42Bd3HyW8KxkUqo2gRA' # push payload json='{"body": "test", "sound": "birdsong"}' -# must be 16 bit long +# Must be 16 bit long key='1234567890123456' -iv='1111111111111111' +# IV can be randomly generated, but if it is random, it needs to be passed in the iv parameter. +iv='1234567890123456' # openssl requires Hex encoding of manual keys and IVs, not ASCII encoding. key=$(printf $key | xxd -ps -c 200) @@ -29,9 +30,9 @@ iv=$(printf $iv | xxd -ps -c 200) ciphertext=$(echo -n $json | openssl enc -aes-128-cbc -K $key -iv $iv | base64) -# The console will print "d3QhjQjP5majvNt5CjsvFWwqqj2gKl96RFj5OO+u6ynTt7lkyigDYNA3abnnCLpr" +# The console will print "+aPt5cwN9GbTLLSFri60l3h1X00u/9j1FENfWiTxhNHVLGU+XoJ15JJG5W/d/yf0" echo $ciphertext # URL encoding the ciphertext, there may be special characters. -curl --data-urlencode "ciphertext=$ciphertext" http://api.day.app/$deviceKey +curl --data-urlencode "ciphertext=$ciphertext" --data-urlencode "iv=1234567890123456" https://api.day.app/$deviceKey ``` \ No newline at end of file