Documentation ¶
Index ¶
- Variables
- type OpenSSHBcryptOpts
- type OpenSSHBcryptbinOpts
- type OpenSSHOpts
- type Options
- type Opts
- type PBKDF2Opts
- type PublicKeyType
- type SSH
- func FromBase64String(data string) SSH
- func FromBytes(data []byte) SSH
- func FromHexString(data string) SSH
- func FromOpenSSHPrivateKey(key []byte) SSH
- func FromOpenSSHPrivateKeyWithPassword(key []byte, password []byte) SSH
- func FromOpenSSHPublicKey(key []byte) SSH
- func FromPrivateKey(key []byte) SSH
- func FromPrivateKeyWithPassword(key []byte, password []byte) SSH
- func FromPublicKey(key []byte) SSH
- func FromString(data string) SSH
- func GenerateKey(options ...Options) SSH
- func GenerateKeyWithSeed(reader io.Reader, options ...Options) SSH
- func New() SSH
- func NewSSH() SSH
- func (this SSH) AppendError(err ...error) SSH
- func (this SSH) CheckKeyPair() bool
- func (this SSH) CreateOpenSSHPrivateKey() SSH
- func (this SSH) CreateOpenSSHPrivateKeyWithPassword(password []byte, opts ...OpenSSHOpts) SSH
- func (this SSH) CreateOpenSSHPublicKey() SSH
- func (this SSH) CreatePrivateKey() SSH
- func (this SSH) CreatePrivateKeyWithPassword(password []byte, opts ...any) SSH
- func (this SSH) CreatePublicKey() SSH
- func (this SSH) Error() error
- func (this SSH) FromBase64String(data string) SSH
- func (this SSH) FromBytes(data []byte) SSH
- func (this SSH) FromHexString(data string) SSH
- func (this SSH) FromOpenSSHPrivateKey(key []byte) SSH
- func (this SSH) FromOpenSSHPrivateKeyWithPassword(key []byte, password []byte) SSH
- func (this SSH) FromOpenSSHPublicKey(key []byte) SSH
- func (this SSH) FromPrivateKey(key []byte) SSH
- func (this SSH) FromPrivateKeyWithPassword(key []byte, password []byte) SSH
- func (this SSH) FromPublicKey(key []byte) SSH
- func (this SSH) FromString(data string) SSH
- func (this SSH) GenerateKey() SSH
- func (this SSH) GenerateKeyWithSeed(reader io.Reader) SSH
- func (this SSH) GetBits() int
- func (this SSH) GetComment() string
- func (this SSH) GetCurve() elliptic.Curve
- func (this SSH) GetData() []byte
- func (this SSH) GetErrors() []error
- func (this SSH) GetKeyData() []byte
- func (this SSH) GetOpenSSHPublicKey() (ssh.PublicKey, error)
- func (this SSH) GetOpenSSHSigner() (ssh.Signer, error)
- func (this SSH) GetOptions() Options
- func (this SSH) GetParameterSizes() dsa.ParameterSizes
- func (this SSH) GetParsedData() []byte
- func (this SSH) GetPrivateKey() crypto.PrivateKey
- func (this SSH) GetPrivateKeyType() PublicKeyType
- func (this SSH) GetPublicKey() crypto.PublicKey
- func (this SSH) GetPublicKeyType() PublicKeyType
- func (this SSH) GetVerify() bool
- func (this SSH) MakePublicKey() SSH
- func (this SSH) OnError(fn func([]error)) SSH
- func (this SSH) ParseOpenSSHPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, string, error)
- func (this SSH) ParseOpenSSHPrivateKeyFromPEMWithPassword(key []byte, password []byte) (crypto.PrivateKey, string, error)
- func (this SSH) ParseOpenSSHPublicKeyFromPEM(key []byte) (crypto.PublicKey, string, error)
- func (this SSH) ParsePKCS8PrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)
- func (this SSH) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password []byte) (crypto.PrivateKey, error)
- func (this SSH) ParsePKCS8PublicKeyFromPEM(key []byte) (crypto.PublicKey, error)
- func (this SSH) SetCurve(curve string) SSH
- func (this SSH) SetOpenSSHPublicKey(key ssh.PublicKey) SSH
- func (this SSH) SetParameterSizes(ln string) SSH
- func (this SSH) SetPublicKeyType(keyType string) SSH
- func (this SSH) Sign() SSH
- func (this SSH) ToBase64String() string
- func (this SSH) ToBytes() []byte
- func (this SSH) ToHexString() string
- func (this SSH) ToKeyBytes() []byte
- func (this SSH) ToKeyString() string
- func (this SSH) ToString() string
- func (this SSH) ToVerify() bool
- func (this SSH) ToVerifyInt() int
- func (this SSH) Verify(data []byte) SSH
- func (this SSH) WithBits(bits int) SSH
- func (this SSH) WithComment(comment string) SSH
- func (this SSH) WithCurve(curve elliptic.Curve) SSH
- func (this SSH) WithData(data []byte) SSH
- func (this SSH) WithErrors(errs []error) SSH
- func (this SSH) WithKeyData(data []byte) SSH
- func (this SSH) WithOptions(options Options) SSH
- func (this SSH) WithParameterSizes(sizes dsa.ParameterSizes) SSH
- func (this SSH) WithParsedData(data []byte) SSH
- func (this SSH) WithPrivateKey(key crypto.PrivateKey) SSH
- func (this SSH) WithPublicKey(key crypto.PublicKey) SSH
- func (this SSH) WithPublicKeyType(keyType PublicKeyType) SSH
- func (this SSH) WithVerify(data bool) SSH
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
var ( // get Cipher type GetCipherFromName = pkcs8.GetCipherFromName // get hash type GetHashFromName = pkcs8.GetHashFromName )
var ( // get OpenSSH Cipher GetOpenSSHCipherFromName = ssh.GetCipherFromName // Default OpenSSH options DefaultOpenSSHOpts = ssh.DefaultOpts )
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 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 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 FromOpenSSHPrivateKeyWithPassword ¶
from OpenSSH PrivateKey with password
func FromPrivateKeyWithPassword ¶
From PrivateKey With Password
func GenerateKeyWithSeed ¶
Generate Key with Reader
func (SSH) CreateOpenSSHPrivateKey ¶
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 ¶
Create OpenSSH PublicKey PEM
func (SSH) CreatePrivateKeyWithPassword ¶
Create PrivateKey PEM With Password
func (SSH) FromOpenSSHPrivateKey ¶
from OpenSSH PrivateKey
func (SSH) FromOpenSSHPrivateKeyWithPassword ¶
from OpenSSH PrivateKey with password
func (SSH) FromOpenSSHPublicKey ¶
from OpenSSH PublicKey
func (SSH) FromPrivateKeyWithPassword ¶
From PrivateKey With Password
func (SSH) GenerateKeyWithSeed ¶
Generate Key with Reader
func (SSH) GetOpenSSHPublicKey ¶
get openssh PublicKey
func (SSH) GetOpenSSHSigner ¶
get openssh Signer
func (SSH) GetParameterSizes ¶
func (this SSH) GetParameterSizes() dsa.ParameterSizes
get DSA ParameterSizes
func (SSH) GetPrivateKeyType ¶
func (this SSH) GetPrivateKeyType() PublicKeyType
get PrivateKey Type
func (SSH) ParseOpenSSHPrivateKeyFromPEM ¶
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 ¶
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 ¶
Parse PKCS8 PublicKey From PEM
func (SSH) SetOpenSSHPublicKey ¶
With openssh PublicKey
func (SSH) SetParameterSizes ¶
With DSA ParameterSizes params: [ L1024N160 | L2048N224 | L2048N256 | L3072N256 ]
func (SSH) SetPublicKeyType ¶
public key type params: [ RSA | DSA | ECDSA | EdDSA | SM2 ]
func (SSH) WithParameterSizes ¶
func (this SSH) WithParameterSizes(sizes dsa.ParameterSizes) SSH
With DSA ParameterSizes
func (SSH) WithPrivateKey ¶
func (this SSH) WithPrivateKey(key crypto.PrivateKey) SSH
With PrivateKey
func (SSH) WithPublicKeyType ¶
func (this SSH) WithPublicKeyType(keyType PublicKeyType) SSH
public key type