checking in prelim stuff

This commit is contained in:
2022-03-05 19:22:40 -05:00
parent 5a9e16f5eb
commit c4783ed1e9
27 changed files with 2082 additions and 4 deletions

42
kdf/funcs.go Normal file
View File

@@ -0,0 +1,42 @@
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
}