1
0

gen-ed25519.sh 850 B

1234567891011121314151617181920212223242526272829303132333435
  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. echo "https://github.com/wolfSSL/wolfssl-examples/pull/52"
  6. pushd ${EXAMPLE}
  7. make
  8. if [ $? -ne 0 ]; then
  9. echo "Unable to build example"
  10. exit 1
  11. fi
  12. ./tls.sh
  13. popd
  14. mv ${EXAMPLE}/*.pem .
  15. mv ${EXAMPLE}/*.der .
  16. convert() {
  17. echo -en "\x30\x2e" > ${NAME}-ed25519-priv.der
  18. head -c 48 ${NAME}-ed25519-key.der | tail -c 46 >> ${NAME}-ed25519-priv.der
  19. echo "-----BEGIN PRIVATE KEY-----" > ${NAME}-ed25519-priv.pem
  20. openssl base64 -in ${NAME}-ed25519-priv.der >> ${NAME}-ed25519-priv.pem
  21. echo "-----END PRIVATE KEY-----" >> ${NAME}-ed25519-priv.pem
  22. }
  23. NAME=server convert
  24. NAME=client convert
  25. NAME=root convert
  26. NAME=ca convert
  27. cp server-ed25519.pem server-ed25519-cert.pem