ecgdsa

package
v1.0.5016 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// get Cipher type
	GetCipherFromName = pkcs8.GetCipherFromName
	// get hash type
	GetHashFromName = pkcs8.GetHashFromName
)
View Source
var (
	// get OpenSSH Cipher
	GetOpenSSHCipherFromName = ssh.GetCipherFromName

	// Default OpenSSH options
	DefaultOpenSSHOpts = ssh.DefaultOpts
)
View Source
var (
	ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded OpenSSH key")
	ErrNotOpenSSHPublicKey = errors.New("key is not a valid SSH public key")

	ErrPrivateKeyError = errors.New("key is not a valid private key")
	ErrPublicKeyError  = errors.New("key is not a valid public key")
)

Functions

This section is empty.

Types

type OpenSSHBcryptOpts added in v1.0.5016

type OpenSSHBcryptOpts = ssh.BcryptOpts

OpenSSH Bcrypt options

type OpenSSHBcryptbinOpts added in v1.0.5016

type OpenSSHBcryptbinOpts = ssh.BcryptbinOpts

OpenSSH Bcryptbin options

type OpenSSHOpts

type OpenSSHOpts = ssh.Opts

OpenSSH options

type Options

type Options struct {
	// public key type
	PublicKeyType PublicKeyType

	// comment data
	Comment string

	// DSA ParameterSizes
	ParameterSizes dsa.ParameterSizes

	// ecc curve
	Curve elliptic.Curve

	// generates RSA private key bit size
	Bits int
}

Options

type Opts

type Opts = pkcs8.Opts

options

type PBKDF2Opts

type PBKDF2Opts = pkcs8.PBKDF2Opts

PBKDF2 options

type PublicKeyType

type PublicKeyType uint

public key type

const (
	KeyTypeUnknown PublicKeyType = iota
	KeyTypeRSA
	KeyTypeDSA
	KeyTypeECDSA
	KeyTypeEdDSA
	KeyTypeSM2
)

func (PublicKeyType) String

func (typ PublicKeyType) String() string

type SSH

type SSH struct {

	// error list
	Errors []error
	// contains filtered or unexported fields
}

*

  • SSH *
  • @create 2025-1-12
  • @author deatil

func FromBase64String

func FromBase64String(data string) SSH

from Base64 string

func FromBytes

func FromBytes(data []byte) SSH

from bytes

func FromHexString

func FromHexString(data string) SSH

from Hex string

func FromOpenSSHPrivateKey

func FromOpenSSHPrivateKey(key []byte) SSH

from OpenSSH PrivateKey

func FromOpenSSHPrivateKeyWithPassword

func FromOpenSSHPrivateKeyWithPassword(key []byte, password []byte) SSH

from OpenSSH PrivateKey with password

func FromOpenSSHPublicKey

func FromOpenSSHPublicKey(key []byte) SSH

from OpenSSH PublicKey

func FromPrivateKey

func FromPrivateKey(key []byte) SSH

From PrivateKey

func FromPrivateKeyWithPassword

func FromPrivateKeyWithPassword(key []byte, password []byte) SSH

From PrivateKey With Password

func FromPublicKey

func FromPublicKey(key []byte) SSH

From PublicKey

func FromString

func FromString(data string) SSH

from string

func GenerateKey

func GenerateKey(options ...Options) SSH

Generate Key

func GenerateKeyWithSeed

func GenerateKeyWithSeed(reader io.Reader, options ...Options) SSH

Generate Key with Reader

func New

func New() SSH

New return a new SSH

func NewSSH

func NewSSH() SSH

NewSSH return a new SSH

func (SSH) AppendError

func (this SSH) AppendError(err ...error) SSH

Append one Error

func (SSH) CheckKeyPair

func (this SSH) CheckKeyPair() bool

Check Key Pair

func (SSH) CreateOpenSSHPrivateKey

func (this SSH) CreateOpenSSHPrivateKey() SSH

Create OpenSSH PrivateKey PEM

func (SSH) CreateOpenSSHPrivateKeyWithPassword

func (this SSH) CreateOpenSSHPrivateKeyWithPassword(password []byte, opts ...OpenSSHOpts) SSH

Create OpenSSH PrivateKey PEM With Password

func (SSH) CreateOpenSSHPublicKey

func (this SSH) CreateOpenSSHPublicKey() SSH

Create OpenSSH PublicKey PEM

func (SSH) CreatePrivateKey

func (this SSH) CreatePrivateKey() SSH

Create PrivateKey PEM

func (SSH) CreatePrivateKeyWithPassword

func (this SSH) CreatePrivateKeyWithPassword(password []byte, opts ...any) SSH

Create PrivateKey PEM With Password

func (SSH) CreatePublicKey

func (this SSH) CreatePublicKey() SSH

Create PublicKey PEM

func (SSH) Error

func (this SSH) Error() error

return Error

func (SSH) FromBase64String

func (this SSH) FromBase64String(data string) SSH

from Base64 string

func (SSH) FromBytes

func (this SSH) FromBytes(data []byte) SSH

from bytes

func (SSH) FromHexString

func (this SSH) FromHexString(data string) SSH

from Hex string

func (SSH) FromOpenSSHPrivateKey

func (this SSH) FromOpenSSHPrivateKey(key []byte) SSH

from OpenSSH PrivateKey

func (SSH) FromOpenSSHPrivateKeyWithPassword

func (this SSH) FromOpenSSHPrivateKeyWithPassword(key []byte, password []byte) SSH

from OpenSSH PrivateKey with password

func (SSH) FromOpenSSHPublicKey

func (this SSH) FromOpenSSHPublicKey(key []byte) SSH

from OpenSSH PublicKey

func (SSH) FromPrivateKey

func (this SSH) FromPrivateKey(key []byte) SSH

From PrivateKey

func (SSH) FromPrivateKeyWithPassword

func (this SSH) FromPrivateKeyWithPassword(key []byte, password []byte) SSH

From PrivateKey With Password

func (SSH) FromPublicKey

func (this SSH) FromPublicKey(key []byte) SSH

From PublicKey

func (SSH) FromString

func (this SSH) FromString(data string) SSH

from string

func (SSH) GenerateKey

func (this SSH) GenerateKey() SSH

Generate Key

func (SSH) GenerateKeyWithSeed

func (this SSH) GenerateKeyWithSeed(reader io.Reader) SSH

Generate Key with Reader

func (SSH) GetBits

func (this SSH) GetBits() int

get Options Bits

func (SSH) GetComment

func (this SSH) GetComment() string

get Options Comment

func (SSH) GetCurve

func (this SSH) GetCurve() elliptic.Curve

get Options Curve

func (SSH) GetData

func (this SSH) GetData() []byte

get data

func (SSH) GetErrors

func (this SSH) GetErrors() []error

get errors

func (SSH) GetKeyData

func (this SSH) GetKeyData() []byte

get keyData

func (SSH) GetOpenSSHPublicKey

func (this SSH) GetOpenSSHPublicKey() (ssh.PublicKey, error)

get openssh PublicKey

func (SSH) GetOpenSSHSigner

func (this SSH) GetOpenSSHSigner() (ssh.Signer, error)

get openssh Signer

func (SSH) GetOptions

func (this SSH) GetOptions() Options

get Options

func (SSH) GetParameterSizes

func (this SSH) GetParameterSizes() dsa.ParameterSizes

get DSA ParameterSizes

func (SSH) GetParsedData

func (this SSH) GetParsedData() []byte

get parsedData

func (SSH) GetPrivateKey

func (this SSH) GetPrivateKey() crypto.PrivateKey

get PrivateKey

func (SSH) GetPrivateKeyType

func (this SSH) GetPrivateKeyType() PublicKeyType

get PrivateKey Type

func (SSH) GetPublicKey

func (this SSH) GetPublicKey() crypto.PublicKey

get PublicKey

func (SSH) GetPublicKeyType

func (this SSH) GetPublicKeyType() PublicKeyType

get PublicKey Type

func (SSH) GetVerify

func (this SSH) GetVerify() bool

get verify data

func (SSH) MakePublicKey

func (this SSH) MakePublicKey() SSH

Make PublicKey

func (SSH) OnError

func (this SSH) OnError(fn func([]error)) SSH

On Error

func (SSH) ParseOpenSSHPrivateKeyFromPEM

func (this SSH) ParseOpenSSHPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, string, error)

Parse OpenSSH PrivateKey From PEM

func (SSH) ParseOpenSSHPrivateKeyFromPEMWithPassword

func (this SSH) ParseOpenSSHPrivateKeyFromPEMWithPassword(key []byte, password []byte) (crypto.PrivateKey, string, error)

Parse OpenSSH PrivateKey From PEM With Password

func (SSH) ParseOpenSSHPublicKeyFromPEM

func (this SSH) ParseOpenSSHPublicKeyFromPEM(key []byte) (crypto.PublicKey, string, error)

Parse OpenSSH PublicKey From PEM

func (SSH) ParsePKCS8PrivateKeyFromPEM

func (this SSH) ParsePKCS8PrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)

Parse PKCS8 PrivateKey From PEM

func (SSH) ParsePKCS8PrivateKeyFromPEMWithPassword

func (this SSH) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password []byte) (crypto.PrivateKey, error)

Parse PKCS8 PrivateKey From PEM With Password

func (SSH) ParsePKCS8PublicKeyFromPEM

func (this SSH) ParsePKCS8PublicKeyFromPEM(key []byte) (crypto.PublicKey, error)

Parse PKCS8 PublicKey From PEM

func (SSH) SetCurve

func (this SSH) SetCurve(curve string) SSH

set Curve type params: [ P521 | P384 | P256 ]

func (SSH) SetOpenSSHPublicKey

func (this SSH) SetOpenSSHPublicKey(key ssh.PublicKey) SSH

With openssh PublicKey

func (SSH) SetParameterSizes

func (this SSH) SetParameterSizes(ln string) SSH

With DSA ParameterSizes params: [ L1024N160 | L2048N224 | L2048N256 | L3072N256 ]

func (SSH) SetPublicKeyType

func (this SSH) SetPublicKeyType(keyType string) SSH

public key type params: [ RSA | DSA | ECDSA | EdDSA | SM2 ]

func (SSH) Sign

func (this SSH) Sign() SSH

privateKey Sign

func (SSH) ToBase64String

func (this SSH) ToBase64String() string

output Base64

func (SSH) ToBytes

func (this SSH) ToBytes() []byte

output Bytes

func (SSH) ToHexString

func (this SSH) ToHexString() string

output Hex

func (SSH) ToKeyBytes

func (this SSH) ToKeyBytes() []byte

output Key Bytes

func (SSH) ToKeyString

func (this SSH) ToKeyString() string

output Key string

func (SSH) ToString

func (this SSH) ToString() string

output string

func (SSH) ToVerify

func (this SSH) ToVerify() bool

output verify

func (SSH) ToVerifyInt

func (this SSH) ToVerifyInt() int

output verify int

func (SSH) Verify

func (this SSH) Verify(data []byte) SSH

publicKey Verify use data to Verify signed data

func (SSH) WithBits

func (this SSH) WithBits(bits int) SSH

RSA private key bit size

func (SSH) WithComment

func (this SSH) WithComment(comment string) SSH

With Comment

func (SSH) WithCurve

func (this SSH) WithCurve(curve elliptic.Curve) SSH

With Curve type

func (SSH) WithData

func (this SSH) WithData(data []byte) SSH

With data

func (SSH) WithErrors

func (this SSH) WithErrors(errs []error) SSH

With Errors

func (SSH) WithKeyData

func (this SSH) WithKeyData(data []byte) SSH

With keyData

func (SSH) WithOptions

func (this SSH) WithOptions(options Options) SSH

With options

func (SSH) WithParameterSizes

func (this SSH) WithParameterSizes(sizes dsa.ParameterSizes) SSH

With DSA ParameterSizes

func (SSH) WithParsedData

func (this SSH) WithParsedData(data []byte) SSH

With parsedData

func (SSH) WithPrivateKey

func (this SSH) WithPrivateKey(key crypto.PrivateKey) SSH

With PrivateKey

func (SSH) WithPublicKey

func (this SSH) WithPublicKey(key crypto.PublicKey) SSH

With PublicKey

func (SSH) WithPublicKeyType

func (this SSH) WithPublicKeyType(keyType PublicKeyType) SSH

public key type

func (SSH) WithVerify

func (this SSH) WithVerify(data bool) SSH

With Verify

type ScryptOpts

type ScryptOpts = pkcs8.ScryptOpts

Scrypt options

Jump to

Keyboard shortcuts

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