mirror of
https://github.com/containers/skopeo.git
synced 2025-08-19 23:17:32 +00:00
Update to use the correct c/image/v4 import path, work originally from https://github.com/containers/skopeo/pull/733 by Valentin Rothberg <rothberg@redhat.com>. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
24 lines
466 B
Go
24 lines
466 B
Go
// +build !libtrust_openssl
|
|
|
|
package libtrust
|
|
|
|
import (
|
|
"crypto"
|
|
"crypto/ecdsa"
|
|
"crypto/rand"
|
|
"fmt"
|
|
"io"
|
|
"math/big"
|
|
)
|
|
|
|
func (k *ecPrivateKey) sign(data io.Reader, hashID crypto.Hash) (r, s *big.Int, err error) {
|
|
hasher := k.signatureAlgorithm.HashID().New()
|
|
_, err = io.Copy(hasher, data)
|
|
if err != nil {
|
|
return nil, nil, fmt.Errorf("error reading data to sign: %s", err)
|
|
}
|
|
hash := hasher.Sum(nil)
|
|
|
|
return ecdsa.Sign(rand.Reader, k.PrivateKey, hash)
|
|
}
|