func encryptKeyKek(keyStr string, kek []byte, keyType string) ([]byte, error) {
	keyData := extractKeyData(keyStr)
	return encryptKeyThalesV(keyData, kek, keyType)
}
encrypt a key under the kek using thales variants
package hsm
import (
	"encoding/hex"
	"errors"
	"github.com/rkbalgi/libiso/crypto"
	"golang.org/x/xerrors"
	"strconv"
)
func genCheckValue(keyData []byte) ([]byte, error) {
	data := make([]byte, 8)
	if len(keyData) == 8 {
		return crypto.EncryptDes(data, keyData)
	} else {
		return crypto.EncryptTripleDes(data, keyData)
	}
}
func extractKeyData(keyStr string) []byte {
	var keyData []byte
	if keyStr[0] == 'U' || keyStr[0] == 'Z' || keyStr[0] == 'T' || keyStr[0] == 'X' || keyStr[0] == 'Y' {
		keyData, _ = hex.DecodeString(keyStr[1:])
	} else {
		keyData, _ = hex.DecodeString(keyStr[:])
	}
	return keyData
}
func encryptKey(keyStr string, keyType string) ([]byte, error) {
	var keyData []byte
	if keyStr[0] == 'U' || keyStr[0] == 'Z' || keyStr[0] == 'T' {
		keyData, _ = hex.DecodeString(keyStr[1:])
	} else {
		keyData, _ = hex.DecodeString(keyStr[:])
	}
	lmkKey := keyTypeTable[keyType[1:]]
	if lmkKey == nil {
		return nil, errors.New("unsupported key type" + keyType)
	}
	return encryptKeyThalesV(keyData, lmkKey, keyType)
}