all the directives are copied in with their types. working on validators now.
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"r00t2.io/sshsecure/sharedconsts"
|
||||
)
|
||||
@@ -34,19 +33,19 @@ func (k *EncryptedSSHKeyV1) validate() error {
|
||||
var validCipher bool
|
||||
var validKDF bool
|
||||
var validKT bool
|
||||
for _, v := range allowed_ciphers {
|
||||
for _, v := range allowedCiphers {
|
||||
if v == k.CipherName {
|
||||
validCipher = true
|
||||
break
|
||||
}
|
||||
}
|
||||
for _, v := range allowed_kdfnames {
|
||||
for _, v := range allowedKdfnames {
|
||||
if v == k.KDFName {
|
||||
validKDF = true
|
||||
break
|
||||
}
|
||||
}
|
||||
for _, v := range allowed_keytypes {
|
||||
for _, v := range allowedKeytypes {
|
||||
if v == k.DefKeyType {
|
||||
validKT = true
|
||||
}
|
||||
@@ -107,7 +106,7 @@ func (k *EncryptedSSHKeyV1) Generate(force bool) error {
|
||||
return errors.New("unknown key type; could not generate private/public keypair")
|
||||
}
|
||||
k.Keys = append(k.Keys, pk)
|
||||
// We also need an encrypter/decrypter since this is an encrypted key.
|
||||
// We also need an encryptor/decryptor since this is an encrypted key.
|
||||
if err := k.setCrypt(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -120,7 +119,7 @@ func (k *EncryptedSSHKeyV1) Generate(force bool) error {
|
||||
|
||||
func (k *SSHKeyV1) validate() error {
|
||||
var validKT bool
|
||||
for _, v := range allowed_keytypes {
|
||||
for _, v := range allowedKeytypes {
|
||||
if v == k.DefKeyType {
|
||||
validKT = true
|
||||
}
|
||||
@@ -143,7 +142,7 @@ func (k *SSHKeyV1) Generate(force bool) error {
|
||||
// Currently, OpenSSH has an option for multiple private keys. However, it is hardcoded to 1.
|
||||
// If multiple key support is added in the future, will need to re-tool how I do this, perhaps, in the future. TODO.
|
||||
pk := SSHPrivKey{
|
||||
Comment: fmt.Sprintf("Autogenerated via SSHSecure (%v)", projUrl),
|
||||
Comment: sharedconsts.IDCmnt,
|
||||
}
|
||||
pk.Checksum = make([]byte, 4)
|
||||
if _, err := rand.Read(pk.Checksum); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user