certs

package
v1.19.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright 2024 The KubeEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 The KubeEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 The KubeEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 The KubeEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 The KubeEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 The KubeEdge Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	CAHandlerTypeX509 = "x509"

	HandlerTypeX509 = "x509"
)

Variables

This section is empty.

Functions

func ReadPEMFile

func ReadPEMFile(file string) (*pem.Block, error)

func WriteDERToPEMFile

func WriteDERToPEMFile(file, t string, der []byte) (*pem.Block, error)

Types

type CAHandler

type CAHandler interface {
	// GenPrivateKey create a private key
	GenPrivateKey() (PrivateKeyWrap, error)

	// New creates CA certificate, returns a pem block.
	NewSelfSigned(key PrivateKeyWrap) (*pem.Block, error)
}

func GetCAHandler

func GetCAHandler(t CAHandlerType) CAHandler

type CAHandlerType

type CAHandlerType string

type Handler

type Handler interface {
	// GenPrivateKey create a private key
	GenPrivateKey() (PrivateKeyWrap, error)

	// CreateCSR create a certificate request, returns a pem block.
	CreateCSR(sub pkix.Name, pkw PrivateKeyWrap, alt *certutil.AltNames) (*pem.Block, error)

	// SignCerts creates a certificate, returns a pem block.
	SignCerts(opts SignCertsOptions) (*pem.Block, error)
}

func GetHandler

func GetHandler(t HanndlerType) Handler

type HanndlerType

type HanndlerType string

type PrivateKeyWrap

type PrivateKeyWrap interface {
	Signer() (crypto.Signer, error)
	DER() []byte
	PEM() []byte
}

type SignCertsOptions

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

func SignCertsOptionsWithCA

func SignCertsOptionsWithCA(cfg certutil.Config, caDER, caKeyDER []byte, publicKey any, expiration time.Duration) SignCertsOptions

func SignCertsOptionsWithCSR

func SignCertsOptionsWithCSR(csrDER, caDER, caKeyDER []byte, usages []x509.ExtKeyUsage, expiration time.Duration) SignCertsOptions

func SignCertsOptionsWithK8sCSR

func SignCertsOptionsWithK8sCSR(csrDER []byte, usages []x509.ExtKeyUsage, expiration time.Duration) SignCertsOptions

Jump to

Keyboard shortcuts

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