Artifact f51c44a744689bdafc3c9209ea4566627a35d037:
- Executable file
build/certs-to-c
— part of check-in
[5027cbae9b]
at
2011-08-26 05:29:43
on branch trunk
— Updated to include DoD root CAs as objects in the PKCS#11 module
Updated to include Netscape Trust Objects (https://developer.mozilla.org/index.php?title=en/NSS/PKCS_%2311_Netscape_Trust) in PKCS#11 module
Added more attributes to scan for to test driver (user: rkeene, size: 532) [annotate] [blame] [check-ins using]
#! /bin/bash
for file in "$@"; do
rm -f tmpfile.x509
openssl x509 -in "${file}" -out tmpfile.x509 -inform pem -outform der
pubkeylen="$(openssl x509 -in tmpfile.x509 -inform der -text -noout | grep 'RSA Public Key:' | sed 's@^.*(\([0-9][0-9]*\) bit).*$@\1@')"
certlen="$(stat -c '%s' tmpfile.x509)"
cert="$(( cat tmpfile.x509 | od -t x1 | cut -c 9- | tr "\n" ' '; echo ) | sed 's@ @@g;s@..@\\x&@g')"
cat << _EOF_
{
{0},
0,
${certlen},
(unsigned char *) "${cert}",
${pubkeylen}
},
_EOF_
done
rm -f tmpfile.x509