func ConvertRawDataToKeyMap(bytes []byte) KeyMap {
	var data KeyFileStruct
	if err := json.Unmarshal(bytes, &data); err != nil {
		log.Printf("could not parse JSON from key file, error=%s\n", err)
		return nil
	}
	if data.Version != "1" {
		log.Printf("wrong key file version %s: should be '1'\n", data.Version)
		return nil
	}
	return data.Keys.convertToKeyMap()
}
Convert file content to a key map
package util
import (
	"encoding/base64"
	"encoding/json"
	"errors"
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"regexp"
	"strconv"
)
var Verbose = false
const (
	masterKeyFile  = "olympus_master_secrets"
	nodeNameRegExp = "^([a-z-]+-\\d+)\\.kubernetes\\.(?:(\\w+)\\.)?(\\w{3}[12])\\.xing\\.com"
)
type warnings int
const (
	logWarnings      warnings = 1
	suppressWarnings warnings = 2
)
type KeyMap map[int]string
type RawKeyMap map[string]string
type KeyFileStruct struct {
	Version string    `json:"version"`
	Keys    RawKeyMap `json:"keys"`
}
func (r *RawKeyMap) convertToKeyMap() KeyMap {
	m := make(KeyMap)
	for k, v := range *r {
		if d, err := strconv.Atoi(k[1:]); err != nil {
			log.Printf("wrong key format: %s: should be 'v\\d+'\n", k)
		} else {
			if v, err := base64.StdEncoding.DecodeString(v); err != nil {
				log.Printf("could not decode value for key %s, error=%s\n", k, err)
			} else {
				m[d] = string(v)
			}
		}
	}
	return m
}