/**
  * @dataProvider dataProviderCheckTokens
  *
  * @param string $secret
  * @param string $expectedResult
  */
 public function testCheckKeyPair($secret)
 {
     $keyPair = new KeyPairObject(2048);
     $encrypted = $keyPair->encrypt($secret);
     $decrypted = $keyPair->decrypt($encrypted);
     $this->assertEquals($decrypted, $secret);
 }
 public function lock(KeyPair $keyPair)
 {
     if (!is_object($this->keyPair)) {
         return false;
     }
     $encryptedKeyPair = $keyPair->encrypt(serialize($this->keyPair));
     if (!$encryptedKeyPair) {
         return false;
     }
     $this->keyPair = $encryptedKeyPair;
     return true;
 }