fcrypt

package
v0.0.0-...-2b5bdcb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertificateProvider

type CertificateProvider interface {
	GetCertificate(certType string, issuer []byte, serial string) (certURL, ketURL string, err error)
}

CertificateProvider interface to get certificate.

type CryptoHandler

type CryptoHandler struct {
	// contains filtered or unexported fields
}

CryptoHandler crypto handler.

func New

func New(
	provider CertificateProvider, cryptocontext *cryptutils.CryptoContext, serviceDiscoveryURL string,
) (handler *CryptoHandler, err error)

New create context for crypto operations.

func (*CryptoHandler) CreateSignContext

func (handler *CryptoHandler) CreateSignContext() (signContext SignContextInterface, err error)

CreateSignContext creates sign context.

func (*CryptoHandler) DecryptAndValidate

func (handler *CryptoHandler) DecryptAndValidate(
	encryptedFile, decryptedFile string, params DecryptParams,
) (err error)

DecryptAndValidate decrypts and validates encrypted image.

func (*CryptoHandler) DecryptMetadata

func (handler *CryptoHandler) DecryptMetadata(input []byte) (output []byte, err error)

DecryptMetadata decrypt envelope.

func (*CryptoHandler) GetCertSerial

func (handler *CryptoHandler) GetCertSerial(certURL string) (serial string, err error)

GetCertSerial returns certificate serial number.

func (*CryptoHandler) GetServiceDiscoveryURLs

func (handler *CryptoHandler) GetServiceDiscoveryURLs() (serviceDiscoveryURLs []string)

GetServiceDiscoveryURLs returns service discovery URLs.

func (*CryptoHandler) GetTLSConfig

func (handler *CryptoHandler) GetTLSConfig() (cfg *tls.Config, err error)

GetTLSConfig Provides TLS configuration for HTTPS client.

func (*CryptoHandler) ImportSessionKey

func (handler *CryptoHandler) ImportSessionKey(
	keyInfo CryptoSessionKeyInfo,
) (symContext SymmetricContextInterface, err error)

ImportSessionKey function retrieves a symmetric key from crypto context.

type CryptoSessionKeyInfo

type CryptoSessionKeyInfo struct {
	SessionKey        []byte       `json:"sessionKey"`
	SessionIV         []byte       `json:"sessionIv"`
	SymmetricAlgName  string       `json:"symmetricAlgName"`
	AsymmetricAlgName string       `json:"asymmetricAlgName"`
	ReceiverInfo      ReceiverInfo `json:"recipientInfo"`
}

CryptoSessionKeyInfo crypto session key info.

type DecryptParams

type DecryptParams struct {
	Chains         []cloudprotocol.CertificateChain
	Certs          []cloudprotocol.Certificate
	DecryptionInfo *cloudprotocol.DecryptionInfo
	Signs          *cloudprotocol.Signs
}

DecryptParams contains necessary parameters for decryption.

type EncryptedContentInfo

type EncryptedContentInfo struct {
	ContentType                asn1.ObjectIdentifier
	ContentEncryptionAlgorithm pkix.AlgorithmIdentifier
	EncryptedContent           []byte `asn1:"optional,implicit,tag:0"`
}

EncryptedContentInfo User-friendly structures.

type ReceiverInfo

type ReceiverInfo struct {
	Serial string
	Issuer []byte
}

ReceiverInfo receiver info.

type SignContext

type SignContext struct {
	// contains filtered or unexported fields
}

SignContext sign context.

func (*SignContext) AddCertificate

func (signContext *SignContext) AddCertificate(fingerprint string, asn1Bytes []byte) error

AddCertificate adds certificate to context.

func (*SignContext) AddCertificateChain

func (signContext *SignContext) AddCertificateChain(name string, fingerprints []string) error

AddCertificateChain adds certificate chain to context.

func (*SignContext) VerifySign

func (signContext *SignContext) VerifySign(
	ctx context.Context, f *os.File, sign *cloudprotocol.Signs,
) (err error)

VerifySign verifies signature.

type SignContextInterface

type SignContextInterface interface {
	AddCertificate(fingerprint string, asn1Bytes []byte) (err error)
	AddCertificateChain(name string, fingerprints []string) (err error)
	VerifySign(ctx context.Context, f *os.File, sign *cloudprotocol.Signs) (err error)
}

SignContextInterface interface for SignContext.

type SymmetricCipherContext

type SymmetricCipherContext struct {
	// contains filtered or unexported fields
}

SymmetricCipherContext symmetric cipher context.

func CreateSymmetricCipherContext

func CreateSymmetricCipherContext() (symContext *SymmetricCipherContext)

CreateSymmetricCipherContext creates symmetric cipher context.

func (*SymmetricCipherContext) DecryptFile

func (symmetricContext *SymmetricCipherContext) DecryptFile(
	ctx context.Context, encryptedFile, clearFile *os.File,
) (err error)

DecryptFile decrypts file.

type SymmetricContextInterface

type SymmetricContextInterface interface {
	DecryptFile(ctx context.Context, encryptedFile, clearFile *os.File) (err error)
}

SymmetricContextInterface interface for SymmetricCipherContext.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL