5.2 Lock/Unlock Text

5.2.1 Lock Text

The lockText function of BayunCore class locks text with default BayunEncryptionPolicy and BayunKeyGenerationPolicy dictated by server settings.

The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the registration/login function response.

  • plainText : Text to be locked.

    • dataType : std::string

#include "BayunCore.h"

std::string cipherText = bayunCore->lockText("<sessionId>", "<plainText>");

5.2.2 Lock Text with Encryption Policy, Key Generation Policy

The lockText function with encryption policy, key generation policy as parameters locks text with the encryption key dictated by the policy. The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the registration/login function response.

  • plainText : Text to be locked.

    • dataType : std::string

  • encryptionPolicy : BayunEncryptionPolicy determines the key to be used to generate the lockingKey.

  • keyGenerationPolicy : BayunKeyGenerationPolicy determines the policy to generate the data encryption key.

  • groupId : GroupId is required if encryptionPolicy is BayunEncryptionPolicyGroup.

If encryptionPolicy is other than BayunEncryptionPolicyGroup then groupId should be nil.

#include "BayunCore.h"

Bayun::BayunEncryptionPolicy encryptionPolicy = Bayun::BayunEncryptionPolicy::Company;
Bayun::BayunKeyGenerationPolicy keyGenerationPolicy = Bayun::BayunKeyGenerationPolicy::Envelop;

std::string lockedText =  bayunCore->lockText("<sessionId>", "<plainText>", encryptionPolicy, keyGenerationPolicy, "<groupId>");

5.2.3 Unlock Text

The unlockText function of BayunCore class unlocks a locked text. The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the registration/login function response.

  • lockedText : Text to be unlocked.

    • dataType : std::string

#include "BayunCore.h"

std::string plainText = bayunCore->unlockText("<sessionId>", "<lockedText>");

Last updated

Was this helpful?