...

Text file src/github.com/sigstore/cosign/v2/test/e2e_test_pkcs11.sh

Documentation: github.com/sigstore/cosign/v2/test

     1#!/usr/bin/env bash
     2
     3# Copyright 2024 The Sigstore Authors.
     4#
     5# Licensed under the Apache License, Version 2.0 (the "License");
     6# you may not use this file except in compliance with the License.
     7# You may obtain a copy of the License at
     8#
     9#     http://www.apache.org/licenses/LICENSE-2.0
    10#
    11# Unless required by applicable law or agreed to in writing, software
    12# distributed under the License is distributed on an "AS IS" BASIS,
    13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14# See the License for the specific language governing permissions and
    15# limitations under the License.
    16
    17set -o errexit
    18set -o nounset
    19set -o pipefail
    20
    21# Test pkcs11 token signing
    22CONTAINER_ID=$(docker run -dit --name softhsm -v $(pwd):/root/cosign -p 2345:2345 vegardit/softhsm2-pkcs11-proxy@sha256:557a65d2a14e3986f2389d36ddce75609cbd8fb7ee6cf08a78adcc8236c2a80e)
    23
    24docker exec -i $CONTAINER_ID /bin/bash << 'EOF'
    25
    26apk update
    27
    28# add make pcsc-lite-libs go command
    29apk add make build-base go
    30
    31cd /root/cosign
    32
    33softhsm2-util --init-token --free --label "My Token" --pin 1234 --so-pin 1234
    34go test -v -cover -coverprofile=./cover.out -tags=softhsm,pkcs11key -coverpkg github.com/sigstore/cosign/v2/pkg/cosign/pkcs11key test/pkcs11_test.go
    35
    36EOF
    37
    38cleanup_pkcs11() {
    39    docker rm -f $CONTAINER_ID
    40}
    41
    42trap cleanup_pkcs11 EXIT

View as plain text