go_sshkeys/kdf/funcs.go

43 lines
775 B
Go

package kdf
import (
"strings"
)
/*
GetKDF returns a KDF from a name of the function.
KDF.Setup must be called on the resulting KDF.
*/
func GetKDF(name string) (k KDF, err error) {
switch strings.ToLower(name) {
case BcryptPbkdfName:
k = &BcryptPbkdf{}
case NullName, "":
k = &Null{}
default:
err = ErrUnknownKdf
return
}
return
}
/*
UnpackKDF returns a KDF from raw data as packed in a private key's bytes.
KDF.Setup must be called on the resulting KDF.
data can be:
- a []byte, which can be:
- the full private key bytes
- KDF section (e.g. _ref/format.ed25519 2.0 + (3.0 to 3.0.0.1) or 2.0.0 + (3.0 to 3.0.0.1))
- a *bytes.Buffer, which supports the same as above
*/
func UnpackKDF(data interface{}) (k KDF, err error) {
return
}