6.4 Get Locking Key
The getLockingKeyFor:keyGenerationPolicy:groupId:success:failure function of BayunCore class returns locking key along with the keys for signature generation and signature verification for an encryption policy.
The function takes the following parameters :
encryptionPolicy : BayunEncryptionPolicy determines the key to be used to generate the lockingKey.
keyGenerationPolicy : BayunKeyGenerationPolicy determine the policy to be used to generate the lockingKey.
groupId: GroupId is required if encryptionPolicy is
BayunEncryptionPolicyGroup. If encryption-policy is other thanBayunEncryptionPolicyGroupthen groupId should be empty string.
BayunEncryptionPolicy encryptionPolicy = BayunEncryptionPolicyCompany;
BayunKeyGenerationPolicy keyGenerationPolicy = BayunKeyGenerationPolicyStatic;
[[BayunCore sharedInstance] getLockingKeyFor:encryptionPolicy keyGenerationPolicy:keyGenerationPolicy groupId:nil success:^(LockingKeys *lockingKeyInfo) {
NSString *key = lockingKeyInfo.key;
} failure:^(BayunError error) {
NSLog(@"Error in Key Generation.");
}]; let encryptionPolicy : BayunEncryptionPolicy = .company
let keyGenerationPolicy : BayunKeyGenerationPolicy = .static
BayunCore.sharedInstance()?.getLockingKey(for:encryptionPolicy, keyGenerationPolicy: keyGenerationPolicy, groupId: "", success: { (lockingKeysInfo) in
let lockingKey = lockingKeysInfo?.key!
}, failure: { (error) in
NSLog("Error in Key Generation.")
})Last updated
Was this helpful?