Skip to content

Commit 5c92a15

Browse files
authored
Merge pull request #1760 from 0chain/fix/encrypt-check
Check if file is encrypted
2 parents ba2c47e + 968d204 commit 5c92a15

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

zboxcore/sdk/sharerequest.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ func (req *ShareRequest) getAuthTicket(clientID, encPublicKey string) (*marker.A
7373
at.Expiration = at.Timestamp + req.expirationSeconds
7474
}
7575

76-
if encPublicKey != "" { // file is encrypted
76+
if fRef.EncryptedKey != "" { // file is encrypted
77+
if encPublicKey == "" {
78+
return nil, errors.New("empty_key", "encryption public key cannot be empty for sharing encrypted files")
79+
}
7780
encScheme := encryption.NewEncryptionScheme()
7881
var entropy string
7982
if fRef.EncryptionVersion == SignatureV2 {

0 commit comments

Comments
 (0)