Esempio 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)
	}
}
Esempio 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)
	}
}