Skip to content

Instantly share code, notes, and snippets.

@edy
Forked from omarstreak/createAndSign.sh
Last active May 19, 2016 11:12
Show Gist options
  • Save edy/5077914 to your computer and use it in GitHub Desktop.
Save edy/5077914 to your computer and use it in GitHub Desktop.
#!/bin/bash
# http://blog.streak.com/2013/01/how-to-build-safari-extension.html
XAR=path/to/xar/bin
BUILD_DIR=path/to/dir/with/cert/files
EXTENSION=your extension name
$XAR -czf $EXTENSION.safariextz --distribution $EXTENSION.safariextension
$XAR --sign -f $EXTENSION.safariextz --digestinfo-to-sign digest.dat --sig-size `cat $BUILD_DIR/size.txt` --cert-loc $BUILD_DIR/cert.der --cert-loc $BUILD_DIR/cert01 --cert-loc $BUILD_DIR/cert02
openssl rsautl -sign -inkey $BUILD_DIR/key.pem -in digest.dat -out sig.dat
$XAR --inject-sig sig.dat -f $EXTENSION.safariextz
rm -f sig.dat digest.dat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment