return false if private key is not valid

remotes/origin/db-empty-migrate
Bjoern Schiessle 11 years ago
parent f893de4136
commit 166e57cf61
  1. 2
      apps/encryption/lib/crypto/crypt.php
  2. 15
      apps/encryption/tests/lib/crypto/cryptTest.php

@ -398,7 +398,7 @@ class Crypt {
}
}
return true;
return false;
}
/**

@ -363,4 +363,19 @@ class cryptTest extends TestCase {
];
}
public function testIsValidPrivateKey() {
$res = openssl_pkey_new();
openssl_pkey_export($res, $privateKey);
// valid private key
$this->assertTrue(
$this->invokePrivate($this->crypt, 'isValidPrivateKey', [$privateKey])
);
// invalid private key
$this->assertFalse(
$this->invokePrivate($this->crypt, 'isValidPrivateKey', ['foo'])
);
}
}

Loading…
Cancel
Save