summaryrefslogtreecommitdiff
path: root/vendor/gopkg.in/square/go-jose.v2/crypter.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-02 06:13:25 -0400
committerGitHub <noreply@github.com>2020-10-02 06:13:25 -0400
commit00c7b493a0565205aa054be7708281874163c85d (patch)
treeef43b932450ef34f26ae3b8d1dda53aab752c760 /vendor/gopkg.in/square/go-jose.v2/crypter.go
parent0b7b22243798650841cd9b790809a0a482f4cbcb (diff)
parent5aead1509c681de533b8966e781e15327fe35ab6 (diff)
downloadpodman-00c7b493a0565205aa054be7708281874163c85d.tar.gz
podman-00c7b493a0565205aa054be7708281874163c85d.tar.bz2
podman-00c7b493a0565205aa054be7708281874163c85d.zip
Merge pull request #7815 from jwhonce/wip/creds_remote
Add X-Registry-Config support
Diffstat (limited to 'vendor/gopkg.in/square/go-jose.v2/crypter.go')
-rw-r--r--vendor/gopkg.in/square/go-jose.v2/crypter.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/vendor/gopkg.in/square/go-jose.v2/crypter.go b/vendor/gopkg.in/square/go-jose.v2/crypter.go
index c45c71206..d24cabf6b 100644
--- a/vendor/gopkg.in/square/go-jose.v2/crypter.go
+++ b/vendor/gopkg.in/square/go-jose.v2/crypter.go
@@ -141,6 +141,8 @@ func NewEncrypter(enc ContentEncryption, rcpt Recipient, opts *EncrypterOptions)
keyID, rawKey = encryptionKey.KeyID, encryptionKey.Key
case *JSONWebKey:
keyID, rawKey = encryptionKey.KeyID, encryptionKey.Key
+ case OpaqueKeyEncrypter:
+ keyID, rawKey = encryptionKey.KeyID(), encryptionKey
default:
rawKey = encryptionKey
}
@@ -267,9 +269,11 @@ func makeJWERecipient(alg KeyAlgorithm, encryptionKey interface{}) (recipientKey
recipient, err := makeJWERecipient(alg, encryptionKey.Key)
recipient.keyID = encryptionKey.KeyID
return recipient, err
- default:
- return recipientKeyInfo{}, ErrUnsupportedKeyType
}
+ if encrypter, ok := encryptionKey.(OpaqueKeyEncrypter); ok {
+ return newOpaqueKeyEncrypter(alg, encrypter)
+ }
+ return recipientKeyInfo{}, ErrUnsupportedKeyType
}
// newDecrypter creates an appropriate decrypter based on the key type
@@ -295,9 +299,11 @@ func newDecrypter(decryptionKey interface{}) (keyDecrypter, error) {
return newDecrypter(decryptionKey.Key)
case *JSONWebKey:
return newDecrypter(decryptionKey.Key)
- default:
- return nil, ErrUnsupportedKeyType
}
+ if okd, ok := decryptionKey.(OpaqueKeyDecrypter); ok {
+ return &opaqueKeyDecrypter{decrypter: okd}, nil
+ }
+ return nil, ErrUnsupportedKeyType
}
// Implementation of encrypt method producing a JWE object.