GoMobile bind OK
This commit is contained in:
13
symcrypt.go
13
symcrypt.go
@ -1,12 +1,8 @@
|
||||
package meowlib
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
"github.com/ProtonMail/gopenpgp/v2/helper"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func SymEncrypt(password string, data []byte) ([]byte, error) {
|
||||
@ -34,7 +30,9 @@ func SymDecrypt(password string, data []byte) ([]byte, error) {
|
||||
return message.GetBinary(), nil
|
||||
}
|
||||
|
||||
func SymEncryptAndSign(PublicEncryptionKey string, PrivateSignatureKey string, data []byte) ([]byte, []byte, error) {
|
||||
/*
|
||||
func SymEncryptAndSign(PublicEncryptionKey string, PrivateSignatureKey string, data []byte) (*EncryptedMessage, error) {
|
||||
var enc EncryptedMessage
|
||||
pub, err := base64.StdEncoding.DecodeString(PublicEncryptionKey)
|
||||
if err != nil {
|
||||
log.Error().Msg("Message encryption and sign b64 failed")
|
||||
@ -47,7 +45,9 @@ func SymEncryptAndSign(PublicEncryptionKey string, PrivateSignatureKey string, d
|
||||
if err != nil {
|
||||
log.Error().Msg("Message encryption and sign failed")
|
||||
}
|
||||
return []byte(encrypted), []byte(signature), err
|
||||
enc.Data = []byte(encrypted)
|
||||
enc.Signature = []byte(signature)
|
||||
return &enc, err
|
||||
}
|
||||
|
||||
func SymDecryptAndCheck(MyPrivateEncryptionKey string, MyContactPublicKey string, data []byte, Signature []byte) (DecryptedMessage []byte, err error) {
|
||||
@ -65,3 +65,4 @@ func SymDecryptAndCheck(MyPrivateEncryptionKey string, MyContactPublicKey string
|
||||
}
|
||||
return DecryptedMessage, err
|
||||
}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user