Skip to content

Commit

Permalink
Merge pull request containers#2 from lumjjb/add_skopeo_gpg_encrypt
Browse files Browse the repository at this point in the history
Added skopeo GPG encrypt support
  • Loading branch information
harche committed Aug 1, 2019
2 parents 6d5c1e3 + e5c7895 commit 8bb4ea7
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions cmd/skopeo/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"io"
"strings"

"github.com/containers/image/encryption/enclib"
encconfig "github.com/containers/image/encryption/enclib/config"
//encutils "github.com/containers/image/encryption/enclib/utils"
"github.com/containers/image/transports/alltransports"
"github.com/containers/image/types"
"github.com/pkg/errors"
Expand Down Expand Up @@ -181,8 +181,21 @@ func (opts *imageOptions) newSystemContext() (*types.SystemContext, error) {
}
encryptCcs := []encconfig.CryptoConfig{}

// TODO: support GPG
_ = gpgRecipients
// Create GPG client with guessed GPG version and default homedir
gpgClient, err := enclib.NewGPGClient("", "")
gpgInstalled := err == nil
if len(gpgRecipients) > 0 && gpgInstalled {
gpgPubRingFile, err := gpgClient.ReadGPGPubRingFile()
if err != nil {
return nil, err
}

gpgCc, err := encconfig.EncryptWithGpg(gpgRecipients, gpgPubRingFile)
if err != nil {
return nil, err
}
encryptCcs = append(encryptCcs, gpgCc)
}

// Create Encryption Crypto Config
pkcs7Cc, err := encconfig.EncryptWithPkcs7(x509s)
Expand Down

0 comments on commit 8bb4ea7

Please sign in to comment.