No description
  • Go 96.8%
  • Shell 2.7%
  • Makefile 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Miloslav Trmač 6a2a20bcf2 Replace golang.org/x/crypto/openpgp with github.com/ProtonMail/go-crypto/openpgp
x/crypto/openpgp now contains a stronger deprecation warning:
> // Deprecated: this package is unsafe by design, and has numerous known security
> // issues. It is not maintained, and should not be used.

and points at github.com/ProtonMail/go-crypto/openpgp , so use that one.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2026-07-18 14:44:00 -04:00
.github/workflows ci: Use go 1.26 rather than 1.24 2026-04-16 09:28:57 -04:00
blockcipher Refactor conditionless else branches with return statementes (govet) 2024-06-11 08:37:04 -04:00
config pkcs11: Add missing support for pkcs11 to SortDecryptionKeys 2026-07-07 05:58:26 -04:00
crypto/pkcs11 Update from unmaintained gopkg.in/yaml.v3 to go.yaml.in/yaml/v3 2026-05-27 10:53:08 -04:00
docs Add documentation for PKCS #11 with IBM CEX 2021-09-17 09:09:12 -04:00
helpers remove github.com/pkg/errors 2023-01-17 17:23:38 -05:00
keywrap Replace golang.org/x/crypto/openpgp with github.com/ProtonMail/go-crypto/openpgp 2026-07-18 14:44:00 -04:00
scripts Allow passing a work directory to softhsm_setup 2020-08-20 22:20:28 -04:00
spec Fix a typo 2023-09-06 20:21:06 -04:00
utils Replace golang.org/x/crypto/openpgp with github.com/ProtonMail/go-crypto/openpgp 2026-07-18 14:44:00 -04:00
.gitignore gitignore: Ignore files with certain file patterns 2022-11-10 10:44:10 -05:00
.golangci.yml ci: Use golangci-lint v2.0.1 2025-03-25 14:29:49 -04:00
ADOPTERS.md Add ADOPTERS.md 2021-05-13 10:50:35 -04:00
CODE-OF-CONDUCT.md Update CODE-OF-CONDUCT.md 2023-01-20 16:42:16 -05:00
encryption.go remove github.com/pkg/errors 2023-01-17 17:23:38 -05:00
encryption_test.go Initial commit from existing library 2019-08-13 17:40:07 -04:00
go.mod Replace golang.org/x/crypto/openpgp with github.com/ProtonMail/go-crypto/openpgp 2026-07-18 14:44:00 -04:00
go.sum Replace golang.org/x/crypto/openpgp with github.com/ProtonMail/go-crypto/openpgp 2026-07-18 14:44:00 -04:00
gpg.go Refactor conditionless else branches with return statementes (govet) 2024-06-11 08:37:04 -04:00
gpgvault.go Replace golang.org/x/crypto/openpgp with github.com/ProtonMail/go-crypto/openpgp 2026-07-18 14:44:00 -04:00
LICENSE Added LICENSE for project 2019-11-12 15:15:05 -05:00
MAINTAINERS Add arronwy as maintainer 2022-04-26 16:31:33 -04:00
Makefile Regenerate the protobuf code to stop using deprecated github.com/golang/protobuf 2026-05-27 10:53:08 -04:00
reader.go Initial commit from existing library 2019-08-13 17:40:07 -04:00
README.md Update README.md 2021-05-14 13:38:10 -04:00
SECURITY.md Update SECURITY.md 2023-01-20 16:42:46 -05:00

OCIcrypt Library

The ocicrypt library is the OCI image spec implementation of container image encryption. More details of the spec can be seen in the OCI repository. The purpose of this library is to encode spec structures and consts in code, as well as provide a consistent implementation of image encryption across container runtimes and build tools.

Consumers of OCIcrypt:

Usage

There are various levels of usage for this library. The main consumers of these would be runtime/build tools, and a more specific use would be in the ability to extend cryptographic function.

Runtime/Build tool usage

The general exposed interface a runtime/build tool would use, would be to perform encryption or decryption of layers:

package "github.com/containers/ocicrypt"
func EncryptLayer(ec *config.EncryptConfig, encOrPlainLayerReader io.Reader, desc ocispec.Descriptor) (io.Reader, EncryptLayerFinalizer, error)
func DecryptLayer(dc *config.DecryptConfig, encLayerReader io.Reader, desc ocispec.Descriptor, unwrapOnly bool) (io.Reader, digest.Digest, error)

The settings/parameters to these functions can be specified via creation of an encryption config with the github.com/containers/ocicrypt/config package. We note that because setting of annotations and other fields of the layer descriptor is done through various means in different runtimes/build tools, it is the responsibility of the caller to still ensure that the layer descriptor follows the OCI specification (i.e. encoding, setting annotations, etc.).

Crypto Agility and Extensibility

The implementation for both symmetric and asymmetric encryption used in this library are behind 2 main interfaces, which users can extend if need be. These are in the following packages:

  • github.com/containers/ocicrypt/blockcipher - LayerBlockCipher interface for block ciphers
  • github.com/containers/ocicrypt/keywrap - KeyWrapper interface for key wrapping

We note that adding interfaces here is risky outside the OCI spec is not recommended, unless for very specialized and confined usecases. Please open an issue or PR if there is a general usecase that could be added to the OCI spec.

Keyprovider interface

As part of the keywrap interface, there is a keyprovider implementation that allows one to call out to a binary or service.

Security Issues

We consider security issues related to this library critical. Please report and security related issues by emailing maintainers in the MAINTAINERS file.

Ocicrypt Pkcs11 Support

Ocicrypt Pkcs11 support is currently experiemental. For more details, please refer to the this document.