gen-ed25519.sh 744 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. EXAMPLE=$1
  3. echo "This uses ed25519 certificate generator from wolfssl-examples github"
  4. echo "The script takes in the directory to wolfssl-examples"
  5. pushd ${EXAMPLE}
  6. make
  7. if [ $? -ne 0 ]; then
  8. echo "Unable to build example"
  9. exit 1
  10. fi
  11. ./tls.sh
  12. popd
  13. mv ${EXAMPLE}/*.pem .
  14. mv ${EXAMPLE}/*.der .
  15. convert() {
  16. echo -en "\x30\x2e" > ${NAME}-ed25519-priv.der
  17. head -c 48 ${NAME}-ed25519-key.der | tail -c 46 >> ${NAME}-ed25519-priv.der
  18. echo "-----BEGIN PRIVATE KEY-----" > ${NAME}-ed25519-priv.pem
  19. openssl base64 -in ${NAME}-ed25519-priv.der >> ${NAME}-ed25519-priv.pem
  20. echo "-----END PRIVATE KEY-----" >> ${NAME}-ed25519-priv.pem
  21. }
  22. NAME=server convert
  23. NAME=client convert
  24. NAME=root convert
  25. NAME=ca convert