You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
There is probably another issue. if there are multiple instances of PubNub with different encryption/decryption keys(cipher key), messages on the second instance of PubNub are not decryptable - looks like it is using one cryptoModule/key for for all instances. But each channel can have unique encryption/decryption keys.
func makePubNub(cryptoKey: String, subscriptionKey: String) -> PubNub {
let cryptoModule = CryptoModule.aesCbcCryptoModule(
with: cryptoKey,
withRandomIV: false
)
let configuration = PubNubConfiguration(
publishKey: nil,
subscribeKey: subscriptionKey,
userId: clientIdentifier(),
cryptoModule: cryptoModule
)
return PubNub(configuration: configuration)
}
let pubNub1 = makePubNub(cryptoKey: "keyForChannel_1", subscriptionKey: ".....")
// addListener pubNub1
pubNub1.subscribe(to: "channel_1")
// send a message to channel_1
// The message will be successfully parsed/decrypted
let pubNub2 = makePubNub(cryptoKey: "keyForChannel_2", subscriptionKey: ".....")
// addListener to pubNub2
pubNub2.subscribe(to: "channel_2")
// send a message to channel_1
// The `channel_1` message will be successfully parsed/decrypted
// send a message to channel_2
// The `channel_2` message will failed on decryption.
Also in logs, it will be;
[Warn 2024-03-13T15:11:30.905Z (com.apple.main-thread#Thread.Main) {SubscribeRouter.decrypt(_:message:)#133}] Subscribe message failed to decrypt due to Failure to perform decryption: Cannot create String from provided Data
The message: PubNubMessageBase will have error:
▿ PubNubMessageBase
- publisher : nil
- channel : "uk.order.edeedxl1zuafgmaxg459oq"
▿ subscription : Optional<String>
- some : "uk.order.edeedxl1zuafgmaxg459oq"
- published : 17103427589802006
- messageType : PubNub.PubNubMessageType.message
▿ error : Optional<PubNubError>
▿ some : Failure to perform decryption: Cannot create String from provided Data
- reason : Failure to perform decryption
▿ details : 1 element
- 0 : "Cannot create String from provided Data"
- underlying : nil
- coorelation : 0 elements
- affected : 0 elements
- router : nil
- domain : "PubNub"
▿ concretePayload : Cu+JjBjKt6ommEBmWZ2zqIhlXmuSWKiZ2ta/KTckNdckK36U6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O0HfjhTYvMxu1U5qqYD3TMHoMJrqOLFXQ61O"
- concreteMessageActions : 0 elements
- concreteMetadata : nil
I checked on 6.2.3 and 7.0.0 SDK.
The text was updated successfully, but these errors were encountered:
This is related to the issue you mentioned before. My initial assumption is that CryptoModule has insufficient implementation for computing a hash value. I will investigate it and let you know.
Hi,
There is probably another issue. if there are multiple instances of
PubNub
with different encryption/decryption keys(cipher key), messages on the second instance of PubNub are not decryptable - looks like it is using onecryptoModule
/key
for for all instances. But each channel can have unique encryption/decryption keys.Also in logs, it will be;
The
message: PubNubMessageBase
will haveerror
:I checked on 6.2.3 and 7.0.0 SDK.
The text was updated successfully, but these errors were encountered: