package utils
import "github.com/containers/ocicrypt/utils"
Index ¶
- func CertifyKey(pubbytes []byte, template *x509.Certificate, caKey *rsa.PrivateKey, caCert *x509.Certificate) (*x509.Certificate, error)
- func CreateECDSATestKey(curve elliptic.Curve) ([]byte, []byte, error)
- func CreateRSAKey(bits int) (*rsa.PrivateKey, error)
- func CreateRSATestKey(bits int, password []byte, pemencode bool) ([]byte, []byte, error)
- func CreateTestCA() (*rsa.PrivateKey, *x509.Certificate, error)
- func FillBuffer(reader io.Reader, buffer []byte) (int, error)
- func IsCertificate(data []byte) bool
- func IsGPGPrivateKeyRing(data []byte) bool
- func IsPasswordError(err error) bool
- func IsPrivateKey(data []byte, password []byte) (bool, error)
- func IsPublicKey(data []byte) bool
- func NewDelayedReader(reader io.Reader, bufsize uint) io.Reader
- func ParseCertificate(certBytes []byte, prefix string) (*x509.Certificate, error)
- func ParsePrivateKey(privKey, privKeyPassword []byte, prefix string) (interface{}, error)
- func ParsePublicKey(pubKey []byte, prefix string) (interface{}, error)
- func SortDecryptionKeys(b64ItemList string) (map[string][][]byte, error)
- type DelayedReader
Functions ¶
func CertifyKey ¶
func CertifyKey(pubbytes []byte, template *x509.Certificate, caKey *rsa.PrivateKey, caCert *x509.Certificate) (*x509.Certificate, error)
CertifyKey certifies a public key using the given CA's private key and cert; The certificate template for the public key is optional
func CreateECDSATestKey ¶
CreateECDSATestKey creates and elliptic curve key for the given curve and returns the public and private key in DER format
func CreateRSAKey ¶
func CreateRSAKey(bits int) (*rsa.PrivateKey, error)
CreateRSAKey creates an RSA key
func CreateRSATestKey ¶
CreateRSATestKey creates an RSA key of the given size and returns the public and private key in PEM or DER format
func CreateTestCA ¶
func CreateTestCA() (*rsa.PrivateKey, *x509.Certificate, error)
CreateTestCA creates a root CA for testing
func FillBuffer ¶
FillBuffer fills the given buffer with as many bytes from the reader as possible. It returns EOF if an EOF was encountered or any other error.
func IsCertificate ¶
IsCertificate returns true in case the given byte array represents an x.509 certificate
func IsGPGPrivateKeyRing ¶
IsGPGPrivateKeyRing returns true in case the given byte array represents a GPG private key ring file
func IsPasswordError ¶
IsPasswordError checks whether an error is related to a missing or wrong password
func IsPrivateKey ¶
IsPrivateKey returns true in case the given byte array represents a private key It returns an error if for example the password is wrong
func IsPublicKey ¶
IsPublicKey returns true in case the given byte array represents a public key
func NewDelayedReader ¶
NewDelayedReader wraps a io.Reader and allocates a delay buffer of bufsize bytes
func ParseCertificate ¶
func ParseCertificate(certBytes []byte, prefix string) (*x509.Certificate, error)
ParseCertificate tries to parse a public key in DER format first and PEM format after, returning an error if the parsing failed
func ParsePrivateKey ¶
ParsePrivateKey tries to parse a private key in DER format first and PEM format after, returning an error if the parsing failed
func ParsePublicKey ¶
ParsePublicKey tries to parse a public key in DER format first and PEM format after, returning an error if the parsing failed
func SortDecryptionKeys ¶
SortDecryptionKeys parses a list of comma separated base64 entries and sorts the data into a map. Each entry in the list may be either a GPG private key ring, private key, or x.509 certificate
Types ¶
type DelayedReader ¶
type DelayedReader struct {
// contains filtered or unexported fields
}
DelayedReader wraps a io.Reader and allows a client to use the Reader interface. The DelayedReader holds back some buffer to the client so that it can report any error that occurred on the Reader it wraps early to the client while it may still have held some data back.
func (*DelayedReader) Read ¶
func (dr *DelayedReader) Read(p []byte) (int, error)
Read implements the io.Reader interface
Source Files ¶
delayedreader.go ioutils.go testing.go utils.go
- Version
- v1.0.1
- Published
- Feb 10, 2020
- Platform
- js/wasm
- Imports
- 17 packages
- Last checked
- 4 hours ago –
Tools for package owners.