Exemplo n.º 1
0
func (option SysOption) GetPrivKey() (*rsa.PrivateKey, error) {
	filePath := helpers.GetFullFilePath(option.KeyDir, privKeyFileName)
	if key, err := ioutil.ReadFile(filePath); err != nil {
		return nil, err
	} else {
		return jwt.ParseRSAPrivateKeyFromPEM(key)
	}
}
Exemplo n.º 2
0
func (option SysOption) GetClientPubKey(keyName string) (*rsa.PublicKey, error) {
	keyDir := path.Join(option.KeyDir, publicKeySubDir)
	filePath := helpers.GetFullFilePath(keyDir, keyName)
	if key, err := ioutil.ReadFile(filePath); err != nil {
		return nil, err
	} else {
		return jwt.ParseRSAPublicKeyFromPEM(key)
	}
}