コード例 #1
0
 *     this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
require_once '../vendor/autoload.php';
use Virgil\SDK\PrivateKeys\Client as PrivateKeysClient;
const VIRGIL_APPLICATION_TOKEN = '17da4b6d03fad06954b5dccd82439b10';
const VIRGIL_USER_NAME = '*****@*****.**';
const VIRGIL_CONTAINER_PASSWORD = '******';
const VIRGIL_PUBLIC_KEY_ID = '5d3a8909-5fe5-2abb-232c-3cf9c277b111';
try {
    // Create Keys Service HTTP Client
    $privateKeysClient = new PrivateKeysClient(VIRGIL_APPLICATION_TOKEN);
    $privateKeysClient->setAuthCredentials(VIRGIL_USER_NAME, VIRGIL_CONTAINER_PASSWORD);
    // Do service call
    echo 'Call Private Key service to get Private Key instance.' . PHP_EOL;
    $privateKey = $privateKeysClient->getPrivateKeysClient()->getPrivateKey(VIRGIL_PUBLIC_KEY_ID);
    echo 'Private Key instance successfully fetched from Private Keys service' . PHP_EOL;
} catch (Exception $e) {
    echo 'Error:' . $e->getMessage();
}
コード例 #2
0
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
require_once '../vendor/autoload.php';
use Virgil\SDK\PrivateKeys\Client as PrivateKeysClient;
const VIRGIL_APPLICATION_TOKEN = '17da4b6d03fad06954b5dccd82439b10';
const VIRGIL_USER_NAME = '*****@*****.**';
const VIRGIL_CONTAINER_PASSWORD = '******';
const VIRGIL_PUBLIC_KEY_ID = '5d3a8909-5fe5-2abb-232c-3cf9c277b111';
const VIRGIL_PRIVATE_KEY_PASSWORD = '******';
try {
    // Create Keys Service HTTP Client
    $privateKeysClient = new PrivateKeysClient(VIRGIL_APPLICATION_TOKEN, array('base_url' => 'https://keyring-stg.virgilsecurity.com'));
    $privateKeysClient->setAuthCredentials(VIRGIL_USER_NAME, VIRGIL_CONTAINER_PASSWORD);
    $privateKeysClient->setHeaders(array('X-VIRGIL-REQUEST-SIGN-PK-ID' => VIRGIL_PUBLIC_KEY_ID));
    echo 'Reading Private Key.' . PHP_EOL;
    $privateKey = file_get_contents('../data/new_private.key');
    echo 'Private Key data successfully readed.' . PHP_EOL;
    // Do service call
    echo 'Call Private Key service to delete Container instance.' . PHP_EOL;
    $privateKeysClient->getContainerClient()->deleteContainer($privateKey, VIRGIL_PRIVATE_KEY_PASSWORD);
    echo 'Container instance successfully deleted from Private Keys service' . PHP_EOL;
} catch (Exception $e) {
    echo 'Error:' . $e->getMessage();
}
コード例 #3
0
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
require_once '../vendor/autoload.php';
use Virgil\SDK\PrivateKeys\Client as PrivateKeysClient, Virgil\SDK\PrivateKeys\Models\UserData;
const VIRGIL_APPLICATION_TOKEN = '17da4b6d03fad06954b5dccd82439b10';
const VIRGIL_USER_NAME = '*****@*****.**';
const VIRGIL_CONTAINER_PASSWORD = '******';
const VIRGIL_USER_DATA_CLASS = 'user_id';
const VIRGIL_USER_DATA_TYPE = 'email';
const VIRGIL_USER_DATA_VALUE = '*****@*****.**';
const VIRGIL_NEW_CONTAINER_PASSWORD = '******';
try {
    // Create Keys Service HTTP Client
    $privateKeysClient = new PrivateKeysClient(VIRGIL_APPLICATION_TOKEN, array('base_url' => 'https://keyring-stg.virgilsecurity.com'));
    $privateKeysClient->setAuthCredentials(VIRGIL_USER_NAME, VIRGIL_CONTAINER_PASSWORD);
    $userData = new UserData();
    $userData->class = VIRGIL_USER_DATA_CLASS;
    $userData->type = VIRGIL_USER_DATA_TYPE;
    $userData->value = VIRGIL_USER_DATA_VALUE;
    // Do service call
    echo 'Call Private Key service to reset Container password.' . PHP_EOL;
    $privateKeysClient->getContainerClient()->resetPassword($userData, VIRGIL_NEW_CONTAINER_PASSWORD);
    echo 'Container password successfully resetted.' . PHP_EOL;
} catch (Exception $e) {
    echo 'Error:' . $e->getMessage();
}
コード例 #4
0
 *     this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
require_once '../vendor/autoload.php';
use Virgil\SDK\PrivateKeys\Client as PrivateKeysClient;
const VIRGIL_APPLICATION_TOKEN = '17da4b6d03fad06954b5dccd82439b10';
const VIRGIL_USER_NAME = '*****@*****.**';
const VIRGIL_CONTAINER_PASSWORD = '******';
const VIRGIL_PUBLIC_KEY_ID = '5d3a8909-5fe5-2abb-232c-3cf9c277b111';
try {
    // Create Keys Service HTTP Client
    $privateKeysClient = new PrivateKeysClient(VIRGIL_APPLICATION_TOKEN, array('base_url' => 'https://keyring-stg.virgilsecurity.com'));
    $privateKeysClient->setAuthCredentials(VIRGIL_USER_NAME, VIRGIL_CONTAINER_PASSWORD);
    // Do service call
    echo 'Call Private Key service to get Container instance.' . PHP_EOL;
    $container = $privateKeysClient->getContainerClient()->getContainer(VIRGIL_PUBLIC_KEY_ID);
    echo 'Container instance successfully fetched from Private Keys service.' . PHP_EOL;
} catch (Exception $e) {
    echo 'Error:' . $e->getMessage();
}
コード例 #5
0
 *     this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
require_once '../vendor/autoload.php';
use Virgil\SDK\PrivateKeys\Client as PrivateKeysClient;
const VIRGIL_APPLICATION_TOKEN = '17da4b6d03fad06954b5dccd82439b10';
const VIRGIL_USER_NAME = '*****@*****.**';
const VIRGIL_CONTAINER_PASSWORD = '******';
const VIRGIL_CONFIRMATION_TOKEN = 'I9Y6Y0';
try {
    // Create Keys Service HTTP Client
    $privateKeysClient = new PrivateKeysClient(VIRGIL_APPLICATION_TOKEN, array('base_url' => 'https://keyring-stg.virgilsecurity.com'));
    $privateKeysClient->setAuthCredentials(VIRGIL_USER_NAME, VIRGIL_CONTAINER_PASSWORD);
    // Do service call
    echo 'Call Private Key service to persist Container.' . PHP_EOL;
    $privateKeysClient->getContainerClient()->persistContainer(VIRGIL_CONFIRMATION_TOKEN);
    echo 'Container successfully persisted.' . PHP_EOL;
} catch (Exception $e) {
    echo 'Error:' . $e->getMessage();
}
コード例 #6
0
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
require_once '../vendor/autoload.php';
use Virgil\SDK\PrivateKeys\Client as PrivateKeysClient;
const VIRGIL_APPLICATION_TOKEN = '17da4b6d03fad06954b5dccd82439b10';
const VIRGIL_PUBLIC_KEY_ID = '5d3a8909-5fe5-2abb-232c-3cf9c277b111';
const VIRGIL_CONTAINER_TYPE = 'normal';
const VIRGIL_CONTAINER_PASSWORD = '******';
const VIRGIL_PRIVATE_KEY_PASSWORD = '******';
try {
    // Create Keys Service HTTP Client
    $privateKeysClient = new PrivateKeysClient(VIRGIL_APPLICATION_TOKEN);
    $privateKeysClient->setHeaders(array('X-VIRGIL-REQUEST-SIGN-PK-ID' => VIRGIL_PUBLIC_KEY_ID));
    echo 'Reading Private Key.' . PHP_EOL;
    $privateKey = file_get_contents('../data/private.key');
    echo 'Private Key data successfully read.' . PHP_EOL;
    // Do service call
    echo 'Call Private Key service to create Container instance.' . PHP_EOL;
    $privateKeysClient->getContainerClient()->createContainer(VIRGIL_CONTAINER_TYPE, VIRGIL_CONTAINER_PASSWORD, $privateKey, VIRGIL_PRIVATE_KEY_PASSWORD);
    echo 'Container instance successfully created in Private Keys service' . PHP_EOL;
} catch (Exception $e) {
    echo 'Error:' . $e->getMessage();
}