1#!/bin/zsh 2#************************************************************** 3# 4# Licensed to the Apache Software Foundation (ASF) under one 5# or more contributor license agreements. See the NOTICE file 6# distributed with this work for additional information 7# regarding copyright ownership. The ASF licenses this file 8# to you under the Apache License, Version 2.0 (the 9# "License"); you may not use this file except in compliance 10# with the License. You may obtain a copy of the License at 11# 12# http://www.apache.org/licenses/LICENSE-2.0 13# 14# Unless required by applicable law or agreed to in writing, 15# software distributed under the License is distributed on an 16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17# KIND, either express or implied. See the License for the 18# specific language governing permissions and limitations 19# under the License. 20# 21#************************************************************** 22# usage: setup-cert.sh -- creates the throw-away NSS database runs/task12/gen-signed/nssdb with one self-signed 23# signing certificate (empty password). Only that directory is written. 24source ${0:A:h}/../../env.sh 25db=$D/runs/task12/gen-signed/nssdb 26[[ -e $db/cert9.db ]] && { echo "setup-cert.sh: $db exists"; exit 0; } 27mkdir -p $db 28certutil -N -d sql:$db --empty-password || exit 1 29head -c 64 /dev/urandom > $db/noise.bin 30certutil -S -d sql:$db -n "ODF Test Signer" -s "CN=ODF Test Signer,O=ODF Validation Harness" -x -t "u,u,u" \ 31 -g 2048 -m 1 -v 120 -z $db/noise.bin --keyUsage digitalSignature,nonRepudiation || exit 1 32/bin/rm -f $db/noise.bin 33certutil -L -d sql:$db 34