1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

feat(api): update DigitalSignatureService (#2539)

This commit is contained in:
Anthony Lapenna 2018-12-12 11:19:23 +13:00 committed by GitHub
parent 5c2e714e69
commit 8a186b4024
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 10 deletions

View file

@ -8,8 +8,6 @@ import (
"encoding/base64"
"encoding/hex"
"math/big"
"github.com/portainer/portainer"
)
const (
@ -105,10 +103,10 @@ func (service *ECDSAService) GenerateKeyPair() ([]byte, []byte, error) {
// CreateSignature creates a digital signature.
// It automatically hash a specific message using MD5 and creates a signature from
// that hash.
// If a secret is associated to the service, it will be used instead of the specified
// message.
// It then encodes the generated signature in base64.
func (service *ECDSAService) CreateSignature() (string, error) {
message := portainer.PortainerAgentSignatureMessage
func (service *ECDSAService) CreateSignature(message string) (string, error) {
if service.secret != "" {
message = service.secret
}