crypto

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CLIENT_KEY_FILENAME string = "client_key.pem"
	CLIENT_PEM_FILENAME string = "client.pem"
	ROOT_CA_FILENAME    string = "root.pem"
)
View Source
const (
	PRIVATE_KEY string = `` /* 3243-byte string literal not displayed */

	PUBLIC_KEY string = `` /* 800-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func InternalDecrypt

func InternalDecrypt(cipher []byte) ([]byte, error)

func InternalEncypt

func InternalEncypt(text []byte) ([]byte, error)

Types

type Certificates

type Certificates struct {
	ClientFile    string `json:"client" yaml:"client"`         // "/client.pem"
	ClientkeyFile string `json:"client_key" yaml:"client_key"` //"/client_key.pem"
	CAFile        string `json:"root_ca" yaml:"root_ca"`       // "/root.pem"
}

Certificates stores where to find certificates used to connect to Engine.

func NewCertificates

func NewCertificates(certFolder string) *Certificates

NewCertificates creates Certificates from folder which contains "client.pem", "client_key.pem" and "root.pem"

func (Certificates) NewRsaKeyPair

func (certs Certificates) NewRsaKeyPair() (*RsaKeyPair, *util.Result)

func (Certificates) NewTlsConfig

func (certs Certificates) NewTlsConfig() (*tls.Config, error)

type CipherFile

type CipherFile struct {
	File string `json:"file" yaml:"file" bson:"file" csv:"file"`
	Text string `json:"-" yaml:"-" bson:"-" csv:"-"`
}

func NewCipherFile

func NewCipherFile(file string) *CipherFile

func (*CipherFile) ReadFromFile

func (c *CipherFile) ReadFromFile() *util.Result

func (CipherFile) WriteToFile

func (c CipherFile) WriteToFile() *util.Result

type KeyPair

type KeyPair struct {
	PrivateKey string `json:"private_key,omitempty" yaml:"private_key,omitempty" bson:"private_key,omitempty"`
	PublicKey  string `json:"public_key,omitempty" yaml:"public_key,omitempty" bson:"public_key,omitempty"`
}
var (
	InternalPrivateKey *rsa.PrivateKey
	InternalKeyPair    *KeyPair
)

func (KeyPair) NewRsaKeyPair

func (kp KeyPair) NewRsaKeyPair() (*RsaKeyPair, *util.Result)

type KeyPairFiles

type KeyPairFiles struct {
	Cert string `json:"cert,omitempty" yaml:"cert,omitempty" bson:"cert,omitempty"`
	Key  string `json:"key,omitempty" yaml:"key,omitempty" bson:"key,omitempty"`
}

type RsaKeyPair

type RsaKeyPair struct {
	Files    *KeyPairFiles     `json:"files,omitempty" yaml:"files,omitempty" bson:"files,omitempty"`
	Key      *rsa.PrivateKey   `json:"key,omitempty" yaml:"key,omitempty" bson:"key,omitempty"`
	Cert     *rsa.PublicKey    `json:"cert,omitempty" yaml:"cert,omitempty" bson:"cert,omitempty"`
	X509Cert *x509.Certificate `json:"x_509_cert,omitempty" yaml:"x_509_cert,omitempty" bson:"x_509_cert,omitempty"`
}

func NewRsaKeyPair

func NewRsaKeyPair(keyPairFiles KeyPairFiles) (*RsaKeyPair, *util.Result)

func (RsaKeyPair) GetKeyPair

func (kp RsaKeyPair) GetKeyPair() (privateKey *rsa.PrivateKey, cert []byte, err error)

Jump to

Keyboard shortcuts

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