kmipclient

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeExecutor

type AttributeExecutor[Req, Resp kmip.OperationPayload, Wrap any] struct {
	Executor[Req, Resp]
	// contains filtered or unexported fields
}

func (AttributeExecutor[Req, Resp, Wrap]) WithAttribute

func (ex AttributeExecutor[Req, Resp, Wrap]) WithAttribute(name kmip.AttributeName, value any) Wrap

func (AttributeExecutor[Req, Resp, Wrap]) WithAttributes

func (ex AttributeExecutor[Req, Resp, Wrap]) WithAttributes(attributes ...kmip.Attribute) Wrap
func (ex AttributeExecutor[Req, Resp, Wrap]) WithLink(linkType kmip.LinkType, linkedObjectID string) Wrap

func (AttributeExecutor[Req, Resp, Wrap]) WithName

func (ex AttributeExecutor[Req, Resp, Wrap]) WithName(name string) Wrap

func (AttributeExecutor[Req, Resp, Wrap]) WithObjectType

func (ex AttributeExecutor[Req, Resp, Wrap]) WithObjectType(objectType kmip.ObjectType) Wrap

func (AttributeExecutor[Req, Resp, Wrap]) WithURI

func (ex AttributeExecutor[Req, Resp, Wrap]) WithURI(uri string) Wrap

func (AttributeExecutor[Req, Resp, Wrap]) WithUniqueID

func (ex AttributeExecutor[Req, Resp, Wrap]) WithUniqueID(id string) Wrap

func (AttributeExecutor[Req, Resp, Wrap]) WithUsageLimit

func (ex AttributeExecutor[Req, Resp, Wrap]) WithUsageLimit(total int64, unit kmip.UsageLimitsUnit) Wrap

type Client

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

func Dial

func Dial(addr string, options ...Option) (*Client, error)

func DialContext

func DialContext(ctx context.Context, addr string, options ...Option) (*Client, error)

func (*Client) Activate

func (c *Client) Activate(id string) ExecActivate

func (*Client) AddAttribute

func (c *Client) AddAttribute(id string, name kmip.AttributeName, value any) ExecAddAttribute

func (*Client) Addr

func (c *Client) Addr() string

func (*Client) Archive

func (c *Client) Archive(id string) ExecArchive

func (*Client) Batch

func (c *Client) Batch(ctx context.Context, payloads ...kmip.OperationPayload) ([]kmip.ResponseBatchItem, error)

func (*Client) Clone

func (c *Client) Clone() (*Client, error)

Clone is like CloneCtx but uses internally a background context.

func (*Client) CloneCtx added in v0.2.5

func (c *Client) CloneCtx(ctx context.Context) (*Client, error)

CloneCtx clones the current kmip client into a new independent client with a separate new connection. The new client inherits allt he configured parameters as well as the negotiated kmip protocol version. Meaning that cloning a client does not perform protocol version negotiation.

Cloning a closed client is valid and will create a new connected client.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Create

func (c *Client) Create() ExecCreateWantType

func (*Client) CreateKeyPair

func (c *Client) CreateKeyPair() ExecCreateKeyPair

func (*Client) Decrypt added in v0.2.5

func (c *Client) Decrypt(id string) ExecDecryptWantsData

func (*Client) DeleteAttribute

func (c *Client) DeleteAttribute(id string, name kmip.AttributeName) ExecDeleteAttribute

func (*Client) Destroy

func (c *Client) Destroy(id string) ExecDestroy

func (*Client) Encrypt added in v0.2.5

func (c *Client) Encrypt(id string) ExecEncryptWantsData

func (*Client) Get

func (c *Client) Get(id string) ExecGet

func (*Client) GetAttributeList

func (c *Client) GetAttributeList(id string) ExecGetAttributeList

func (*Client) GetAttributes

func (c *Client) GetAttributes(id string, attributes ...kmip.AttributeName) ExecGetAttributes

func (*Client) GetUsageAllocation

func (c *Client) GetUsageAllocation(id string, limitCount int64) ExecGetUsageAllocation

func (*Client) Locate

func (c *Client) Locate() ExecLocate

func (*Client) ModifyAttribute

func (c *Client) ModifyAttribute(id string, name kmip.AttributeName, value any) ExecModifyAttribute

func (*Client) ObtainLease

func (c *Client) ObtainLease(id string) ExecObtainLease

func (*Client) Query

func (c *Client) Query() ExecQuery

func (*Client) Recover

func (c *Client) Recover(id string) ExecRecover

func (*Client) Register

func (c *Client) Register() ExecRegisterWantType

func (*Client) Rekey

func (c *Client) Rekey(id string) ExecRekey

func (*Client) Request

func (c *Client) Request(ctx context.Context, payload kmip.OperationPayload) (kmip.OperationPayload, error)

func (*Client) Revoke

func (c *Client) Revoke(id string) ExecRevoke

func (*Client) Roundtrip

func (c *Client) Roundtrip(ctx context.Context, msg *kmip.RequestMessage) (*kmip.ResponseMessage, error)

func (*Client) Sign added in v0.2.5

func (c *Client) Sign(id string) ExecSignWantsData

func (*Client) SignatureVerify added in v0.2.5

func (c *Client) SignatureVerify(id string) ExecSignatureVerifyWantsData

func (*Client) Version

func (c *Client) Version() kmip.ProtocolVersion

type ExecAddAttribute

func (ExecAddAttribute) WithIndex

func (ex ExecAddAttribute) WithIndex(index int32) ExecAddAttribute

type ExecCreate

func (ExecCreate) WithTemplate deprecated

func (ex ExecCreate) WithTemplate(name string, nameType kmip.NameType) ExecCreate

Deprecated: Templates have been deprecated in KMIP v1.3.

func (ExecCreate) WithTemplates deprecated

func (ex ExecCreate) WithTemplates(names ...kmip.Name) ExecCreate

Deprecated: Templates have been deprecated in KMIP v1.3.

type ExecCreateKeyPair

func (ExecCreateKeyPair) Common

func (ExecCreateKeyPair) ECDSA

func (ex ExecCreateKeyPair) ECDSA(curve kmip.RecommendedCurve, privateUsage, publicUsage kmip.CryptographicUsageMask) ExecCreateKeyPairAttr

func (ExecCreateKeyPair) PrivateKey

func (ex ExecCreateKeyPair) PrivateKey() ExecCreateKeyPairAttr

func (ExecCreateKeyPair) PublicKey

func (ExecCreateKeyPair) RSA

func (ex ExecCreateKeyPair) RSA(bitlen int, privateUsage, publicUsage kmip.CryptographicUsageMask) ExecCreateKeyPairAttr

type ExecCreateKeyPairAttr

type ExecCreateKeyPairAttr struct {
	AttributeExecutor[*payloads.CreateKeyPairRequestPayload, *payloads.CreateKeyPairResponsePayload, ExecCreateKeyPairAttr]
	// contains filtered or unexported fields
}

func (ExecCreateKeyPairAttr) Common

func (ExecCreateKeyPairAttr) PrivateKey

func (ExecCreateKeyPairAttr) PublicKey

func (ExecCreateKeyPairAttr) WithTemplate deprecated

func (ex ExecCreateKeyPairAttr) WithTemplate(name string, nameType kmip.NameType) ExecCreateKeyPairAttr

Deprecated: Templates have been deprecated in KMIP v1.3.

func (ExecCreateKeyPairAttr) WithTemplates deprecated

func (ex ExecCreateKeyPairAttr) WithTemplates(names ...kmip.Name) ExecCreateKeyPairAttr

Deprecated: Templates have been deprecated in KMIP v1.3.

type ExecCreateWantType

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

func (ExecCreateWantType) AES

func (ex ExecCreateWantType) AES(length int, usage kmip.CryptographicUsageMask) ExecCreate

func (ExecCreateWantType) Object

func (ex ExecCreateWantType) Object(objectType kmip.ObjectType, attrs ...kmip.Attribute) ExecCreate

func (ExecCreateWantType) Skipjack

func (ex ExecCreateWantType) Skipjack(usage kmip.CryptographicUsageMask) ExecCreate

func (ExecCreateWantType) SymmetricKey

func (ex ExecCreateWantType) SymmetricKey(alg kmip.CryptographicAlgorithm, length int, usage kmip.CryptographicUsageMask) ExecCreate

func (ExecCreateWantType) TDES

func (ex ExecCreateWantType) TDES(length int, usage kmip.CryptographicUsageMask) ExecCreate

type ExecDecrypt added in v0.2.5

type ExecDecryptWantsData added in v0.2.5

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

func (ExecDecryptWantsData) Data added in v0.2.5

func (ex ExecDecryptWantsData) Data(data []byte) ExecDecrypt

func (ExecDecryptWantsData) WithAAD added in v0.2.5

func (ExecDecryptWantsData) WithAuthTag added in v0.2.5

func (ex ExecDecryptWantsData) WithAuthTag(tag []byte) ExecDecryptWantsData

func (ExecDecryptWantsData) WithCryptographicParameters added in v0.2.5

func (ex ExecDecryptWantsData) WithCryptographicParameters(params kmip.CryptographicParameters) ExecDecryptWantsData

func (ExecDecryptWantsData) WithIvCounterNonce added in v0.2.5

func (ex ExecDecryptWantsData) WithIvCounterNonce(iv []byte) ExecDecryptWantsData

type ExecDeleteAttribute

func (ExecDeleteAttribute) WithIndex

func (ex ExecDeleteAttribute) WithIndex(index int32) ExecDeleteAttribute

type ExecEncrypt added in v0.2.5

type ExecEncryptWantsData added in v0.2.5

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

func (ExecEncryptWantsData) Data added in v0.2.5

func (ex ExecEncryptWantsData) Data(data []byte) ExecEncrypt

func (ExecEncryptWantsData) WithAAD added in v0.2.5

func (ExecEncryptWantsData) WithCryptographicParameters added in v0.2.5

func (ex ExecEncryptWantsData) WithCryptographicParameters(params kmip.CryptographicParameters) ExecEncryptWantsData

func (ExecEncryptWantsData) WithIvCounterNonce added in v0.2.5

func (ex ExecEncryptWantsData) WithIvCounterNonce(iv []byte) ExecEncryptWantsData

type ExecGet

func (ExecGet) WithKeyCompression

func (ex ExecGet) WithKeyCompression(compression kmip.KeyCompressionType) ExecGet

func (ExecGet) WithKeyFormat

func (ex ExecGet) WithKeyFormat(format kmip.KeyFormatType) ExecGet

func (ExecGet) WithKeyWrapType

func (ex ExecGet) WithKeyWrapType(format kmip.KeyFormatType) ExecGet

func (ExecGet) WithKeyWrapping

func (ex ExecGet) WithKeyWrapping(spec kmip.KeyWrappingSpecification) ExecGet

type ExecGetAttributes

func (ExecGetAttributes) WithAttributes

func (ex ExecGetAttributes) WithAttributes(names ...kmip.AttributeName) ExecGetAttributes

type ExecLocate

func (ExecLocate) WithMaxItems

func (ex ExecLocate) WithMaxItems(maximum int32) ExecLocate

func (ExecLocate) WithObjectGroupMember

func (ex ExecLocate) WithObjectGroupMember(groupMember kmip.ObjectGroupMember) ExecLocate

func (ExecLocate) WithOffset

func (ex ExecLocate) WithOffset(offset int32) ExecLocate

func (ExecLocate) WithStorageStatusMask

func (ex ExecLocate) WithStorageStatusMask(mask kmip.StorageStatusMask) ExecLocate

type ExecModifyAttribute

func (ExecModifyAttribute) WithIndex

func (ex ExecModifyAttribute) WithIndex(index int32) ExecModifyAttribute

type ExecQuery

func (ExecQuery) All

func (ex ExecQuery) All() ExecQuery

func (ExecQuery) ApplicationNamespaces

func (ex ExecQuery) ApplicationNamespaces() ExecQuery

func (ExecQuery) AttestationTypes

func (ex ExecQuery) AttestationTypes() ExecQuery

KMIP 1.2.

func (ExecQuery) Capabilities

func (ex ExecQuery) Capabilities() ExecQuery

func (ExecQuery) ClientRegistrationMethods

func (ex ExecQuery) ClientRegistrationMethods() ExecQuery

func (ExecQuery) ExtensionList

func (ex ExecQuery) ExtensionList() ExecQuery

KMIP 1.1.

func (ExecQuery) ExtensionMap

func (ex ExecQuery) ExtensionMap() ExecQuery

KMIP 1.1.

func (ExecQuery) Objects

func (ex ExecQuery) Objects() ExecQuery

func (ExecQuery) Operations

func (ex ExecQuery) Operations() ExecQuery

func (ExecQuery) Profiles

func (ex ExecQuery) Profiles() ExecQuery

func (ExecQuery) RNGs

func (ex ExecQuery) RNGs() ExecQuery

KMIP 1.3.

func (ExecQuery) ServerInformation

func (ex ExecQuery) ServerInformation() ExecQuery

func (ExecQuery) Validations

func (ex ExecQuery) Validations() ExecQuery

type ExecRegisterWantType

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

func (ExecRegisterWantType) Certificate

func (ex ExecRegisterWantType) Certificate(kind kmip.CertificateType, value []byte) ExecRegister

func (ExecRegisterWantType) EcdsaPrivateKey

func (ex ExecRegisterWantType) EcdsaPrivateKey(key *ecdsa.PrivateKey, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) EcdsaPublicKey

func (ex ExecRegisterWantType) EcdsaPublicKey(key *ecdsa.PublicKey, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) Object

func (ex ExecRegisterWantType) Object(value kmip.Object) ExecRegister

func (ExecRegisterWantType) PemCertificate

func (ex ExecRegisterWantType) PemCertificate(data []byte) ExecRegister

func (ExecRegisterWantType) PemKey

func (ex ExecRegisterWantType) PemKey(data []byte, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) PemPrivateKey added in v0.2.1

func (ex ExecRegisterWantType) PemPrivateKey(data []byte, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) PemPublicKey added in v0.2.1

func (ex ExecRegisterWantType) PemPublicKey(data []byte, usage kmip.CryptographicUsageMask) ExecRegister

PemPublicKey registers a public key from PEM data. It also accepts PEM encoded private keys but will register only the public key part of it.

func (ExecRegisterWantType) Pkcs1PrivateKey

func (ex ExecRegisterWantType) Pkcs1PrivateKey(der []byte, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) Pkcs1PublicKey

func (ex ExecRegisterWantType) Pkcs1PublicKey(der []byte, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) Pkcs8PrivateKey

func (ex ExecRegisterWantType) Pkcs8PrivateKey(der []byte, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) PrivateKey

func (ex ExecRegisterWantType) PrivateKey(key PrivateKey, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) PublicKey

func (ex ExecRegisterWantType) PublicKey(key PublicKey, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) RsaPrivateKey

func (ex ExecRegisterWantType) RsaPrivateKey(key *rsa.PrivateKey, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) RsaPublicKey

func (ex ExecRegisterWantType) RsaPublicKey(key *rsa.PublicKey, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) Sec1PrivateKey

func (ex ExecRegisterWantType) Sec1PrivateKey(der []byte, usage kmip.CryptographicUsageMask) ExecRegister

func (ExecRegisterWantType) Secret

func (ex ExecRegisterWantType) Secret(kind kmip.SecretDataType, value []byte) ExecRegister

func (ExecRegisterWantType) SecretString

func (ex ExecRegisterWantType) SecretString(kind kmip.SecretDataType, value string) ExecRegister

func (ExecRegisterWantType) SymmetricKey

func (ex ExecRegisterWantType) SymmetricKey(alg kmip.CryptographicAlgorithm, usage kmip.CryptographicUsageMask, value []byte) ExecRegister

func (ExecRegisterWantType) WithKeyFormat

func (ex ExecRegisterWantType) WithKeyFormat(format KeyFormat) ExecRegisterWantType

func (ExecRegisterWantType) X509Certificate

func (ex ExecRegisterWantType) X509Certificate(cert *x509.Certificate) ExecRegister

func (ExecRegisterWantType) X509PublicKey

func (ex ExecRegisterWantType) X509PublicKey(der []byte, usage kmip.CryptographicUsageMask) ExecRegister

type ExecRekey

func (ExecRekey) WithOffset

func (ex ExecRekey) WithOffset(offset time.Duration) ExecRekey

func (ExecRekey) WithTemplate deprecated

func (ex ExecRekey) WithTemplate(name string, nameType kmip.NameType) ExecRekey

Deprecated: Templates have been deprecated in KMIP v1.3.

func (ExecRekey) WithTemplates deprecated

func (ex ExecRekey) WithTemplates(names ...kmip.Name) ExecRekey

Deprecated: Templates have been deprecated in KMIP v1.3.

type ExecRevoke

func (ExecRevoke) WithCompromiseOccurrenceDate

func (ex ExecRevoke) WithCompromiseOccurrenceDate(dt time.Time) ExecRevoke

func (ExecRevoke) WithRevocationMessage

func (ex ExecRevoke) WithRevocationMessage(msg string) ExecRevoke

func (ExecRevoke) WithRevocationReasonCode

func (ex ExecRevoke) WithRevocationReasonCode(code kmip.RevocationReasonCode) ExecRevoke

type ExecSign added in v0.2.5

type ExecSignWantsData added in v0.2.5

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

func (ExecSignWantsData) Data added in v0.2.5

func (ex ExecSignWantsData) Data(data []byte) ExecSign

func (ExecSignWantsData) DigestedData added in v0.2.5

func (ex ExecSignWantsData) DigestedData(data []byte) ExecSign

func (ExecSignWantsData) WithCryptographicParameters added in v0.2.5

func (ex ExecSignWantsData) WithCryptographicParameters(params kmip.CryptographicParameters) ExecSignWantsData

type ExecSignatureVerifyWantsData added in v0.2.5

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

func (ExecSignatureVerifyWantsData) Data added in v0.2.5

func (ExecSignatureVerifyWantsData) DigestedData added in v0.2.5

func (ExecSignatureVerifyWantsData) Signature added in v0.2.5

func (ExecSignatureVerifyWantsData) WithCryptographicParameters added in v0.2.5

func (ex ExecSignatureVerifyWantsData) WithCryptographicParameters(params kmip.CryptographicParameters) ExecSignatureVerifyWantsData

type ExecSignatureVerifyWantsSignature added in v0.2.5

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

func (ExecSignatureVerifyWantsSignature) Signature added in v0.2.5

type Executor

type Executor[Req, Resp kmip.OperationPayload] struct {
	// contains filtered or unexported fields
}

func (Executor[Req, Resp]) Exec

func (ex Executor[Req, Resp]) Exec() (Resp, error)

Exec sends the request to the remote KMIP server, and returns the parsed response.

It returns an error if the request could not be sent, or if the server replies with KMIP error.

func (Executor[Req, Resp]) ExecContext

func (ex Executor[Req, Resp]) ExecContext(ctx context.Context) (Resp, error)

ExecContext sends the request to the remote KMIP server, and returns the parsed response.

It returns an error if the request could not be sent, or if the server replies with KMIP error.

func (Executor[Req, Resp]) MustExec

func (ex Executor[Req, Resp]) MustExec() Resp

MustExec is like Exec except it panics if the request fails.

func (Executor[Req, Resp]) MustExecContext

func (ex Executor[Req, Resp]) MustExecContext(ctx context.Context) Resp

MustExecContext is like Exec except it panics if the request fails.

func (Executor[Req, Resp]) RequestPayload

func (ex Executor[Req, Resp]) RequestPayload() Req

type KeyFormat

type KeyFormat uint8
const (
	Transparent KeyFormat = 1 << iota
	X509
	PKCS8
	PKCS1
	SEC1
	RAW
)

type Middleware

type Middleware func(next Next, ctx context.Context, msg *kmip.RequestMessage) (*kmip.ResponseMessage, error)

func CorrelationValueMiddleware

func CorrelationValueMiddleware(fn func() string) Middleware

func DebugMiddleware

func DebugMiddleware(out io.Writer, marshal func(data any) []byte) Middleware

func TimeoutMiddleware added in v0.2.5

func TimeoutMiddleware(timeout time.Duration) Middleware

type Next

type Next func(context.Context, *kmip.RequestMessage) (*kmip.ResponseMessage, error)

type Option

type Option func(*opts) error

func EnforceVersion

func EnforceVersion(v kmip.ProtocolVersion) Option

func WithClientCert

func WithClientCert(cert tls.Certificate) Option

func WithClientCertFiles

func WithClientCertFiles(certFile, keyFile string) Option

func WithClientCertPEM

func WithClientCertPEM(certPEMBlock, keyPEMBlock []byte) Option

func WithKmipVersions

func WithKmipVersions(versions ...kmip.ProtocolVersion) Option

func WithMiddlewares

func WithMiddlewares(middlewares ...Middleware) Option

func WithRootCAFile

func WithRootCAFile(path string) Option

WithRootCAFile adds the CA in the file located at `path` t othe clients CA pool. If path is an empty string, the option is a no-op.

func WithRootCAPem

func WithRootCAPem(pem []byte) Option

func WithServerName

func WithServerName(name string) Option

func WithTlsCipherSuiteNames added in v0.3.0

func WithTlsCipherSuiteNames(ciphers ...string) Option

func WithTlsCipherSuites added in v0.3.0

func WithTlsCipherSuites(ciphers ...uint16) Option

func WithTlsConfig added in v0.1.0

func WithTlsConfig(cfg *tls.Config) Option

type PrivateKey

type PrivateKey interface {
	Public() crypto.PublicKey
	Equal(x crypto.PrivateKey) bool
}

type PublicKey

type PublicKey interface {
	Equal(x crypto.PublicKey) bool
}

Jump to

Keyboard shortcuts

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