mirror of
https://github.com/containers/skopeo.git
synced 2025-08-31 22:28:33 +00:00
fix(deps): update module github.com/containers/ocicrypt to v1.1.10
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
17
vendor/github.com/containers/ocicrypt/keywrap/jwe/keywrapper_jwe.go
generated
vendored
17
vendor/github.com/containers/ocicrypt/keywrap/jwe/keywrapper_jwe.go
generated
vendored
@@ -123,9 +123,24 @@ func addPubKeys(joseRecipients *[]jose.Recipient, pubKeys [][]byte) error {
|
||||
}
|
||||
|
||||
alg := jose.RSA_OAEP
|
||||
switch key.(type) {
|
||||
switch key := key.(type) {
|
||||
case *ecdsa.PublicKey:
|
||||
alg = jose.ECDH_ES_A256KW
|
||||
case *jose.JSONWebKey:
|
||||
if key.Algorithm != "" {
|
||||
alg = jose.KeyAlgorithm(key.Algorithm)
|
||||
switch alg {
|
||||
/* accepted algorithms */
|
||||
case jose.RSA_OAEP:
|
||||
case jose.RSA_OAEP_256:
|
||||
case jose.ECDH_ES_A128KW:
|
||||
case jose.ECDH_ES_A192KW:
|
||||
case jose.ECDH_ES_A256KW:
|
||||
/* all others are rejected */
|
||||
default:
|
||||
return fmt.Errorf("%s is an unsupported JWE key algorithm", alg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*joseRecipients = append(*joseRecipients, jose.Recipient{
|
||||
|
13
vendor/github.com/containers/ocicrypt/utils/testing.go
generated
vendored
13
vendor/github.com/containers/ocicrypt/utils/testing.go
generated
vendored
@@ -38,6 +38,15 @@ func CreateRSAKey(bits int) (*rsa.PrivateKey, error) {
|
||||
return key, nil
|
||||
}
|
||||
|
||||
// CreateECDSAKey creates an elliptic curve key for the given curve
|
||||
func CreateECDSAKey(curve elliptic.Curve) (*ecdsa.PrivateKey, error) {
|
||||
key, err := ecdsa.GenerateKey(curve, rand.Reader)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("ecdsa.GenerateKey failed: %w", err)
|
||||
}
|
||||
return key, nil
|
||||
}
|
||||
|
||||
// CreateRSATestKey creates an RSA key of the given size and returns
|
||||
// the public and private key in PEM or DER format
|
||||
func CreateRSATestKey(bits int, password []byte, pemencode bool) ([]byte, []byte, error) {
|
||||
@@ -85,9 +94,9 @@ func CreateRSATestKey(bits int, password []byte, pemencode bool) ([]byte, []byte
|
||||
// CreateECDSATestKey creates and elliptic curve key for the given curve and returns
|
||||
// the public and private key in DER format
|
||||
func CreateECDSATestKey(curve elliptic.Curve) ([]byte, []byte, error) {
|
||||
key, err := ecdsa.GenerateKey(curve, rand.Reader)
|
||||
key, err := CreateECDSAKey(curve)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("ecdsa.GenerateKey failed: %w", err)
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pubData, err := x509.MarshalPKIXPublicKey(&key.PublicKey)
|
||||
|
Reference in New Issue
Block a user