| 1 | // |
| 2 | // Copyright 2021 The Sigstore Authors. |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | package optionsscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/ |
| 17 | |
| 18 | // RequestDigest implements the functional option pattern for specifying a digest value |
| 19 | type RequestDigestscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestDigest# struct { |
| 20 | NoOpOptionImplscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestDigest#NoOpOptionImpl. |
| 21 | digestscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestDigest#digest. []byte |
| 22 | } |
| 23 | |
| 24 | // ApplyDigest sets the specified digest value as the functional option |
| 25 | func (r RequestDigestscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestDigest#) ApplyDigestscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestDigest#ApplyDigest().(digest *[]byte) { |
| 26 | *digest = r.digestscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestDigest#digest. |
| 27 | } |
| 28 | |
| 29 | // WithDigest specifies that the given digest can be used by underlying signature implementations |
| 30 | // WARNING: When verifying a digest with ECDSA, it is trivial to craft a valid signature |
| 31 | // over a random message given a public key. Do not use this unles you understand the |
| 32 | // implications and do not need to protect against malleability. |
| 33 | func WithDigestscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/WithDigest().(digest []byte) RequestDigestscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestDigest# { |
| 34 | return RequestDigestscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestDigest#{digestscip-go gomod github.com/sigstore/sigstore . `github.com/sigstore/sigstore/pkg/signature/options`/RequestDigest#digest.: digest} |
| 35 | } |