Пример #1
0
//Sign the stringToSign using the private key
func (v4 *signer) buildRsaSignature() (err error) {
	var rsaKey auth.RsaKey
	rsaKey, err = auth.DecodePrivateKey(v4.CredValues.SecretAccessKey)
	if err != nil {
		return
	}
	v4.signature, err = rsaKey.Sign(v4.stringToSign)
	return
}
Пример #2
0
// GenerateKeyPair generate a new keypair
func GenerateKeyPair() (publicKey, privateKey, keyType string, err error) {
	var keyPair auth.RsaKey

	keyPair, err = auth.CreateKeypair()
	if err != nil {
		return
	}

	privateKey, err = keyPair.EncodePrivateKey()
	if err != nil {
		return
	}

	publicKey, err = keyPair.EncodePublicKey()
	if err != nil {
		return
	}

	keyType = auth.KeyType
	return
}