라이브러리

[PHP] MongoDBDriverClientEncryption::getKeys - 모든 키 문서를 가져옵니다.




MongoDB Driver Client Encryption

MongoDB Driver Client Encryption은 MongoDB의 데이터를 암호화하는 데 사용되는 라이브러리입니다. 이 라이브러리에서는 MongoDB Driver의 Client-Side Encryption 기능을 사용하여 데이터를 암호화하고, MongoDB Server에서 데이터를 암호화하기 전에 암호화된 데이터를 보낼 수 있습니다.

MongoDBDriverClientEncryption::getKeys

`MongoDBDriverClientEncryption::getKeys` 메서드는 Client-Side Encryption에서 사용되는 암호화 키를 반환합니다. 이 메서드는 `MongoDBDriverClientEncryption` 객체의 인스턴스를 생성하고, `getKeys` 메서드를 호출하여 암호화 키를 반환합니다.

예제

#hostingforum.kr
php

use MongoDBDriverClientEncryption;

use MongoDBDriverEncryptionOptions;

use MongoDBDriverKeyManagementClient;

use MongoDBDriverKeyManagementClientOptions;



// MongoDB Server에 연결하는 코드

$manager = new MongoDBDriverManager("mongodb://localhost:27017");



// Client-Side Encryption을 위한 Key Management Client 생성

$keyManagementClient = new KeyManagementClient(

    new KeyManagementClientOptions(

        [

            'server' => 'mongodb://localhost:27017',

            'username' => 'admin',

            'password' => 'password',

        ]

    )

);



// Client-Side Encryption을 위한 Key Management Client에 연결

$keyManagementClient->connect();



// Client-Side Encryption을 위한 Key Management Client에서 암호화 키를 가져옵니다.

$encryptionKey = $keyManagementClient->getKey();



// Client-Side Encryption을 위한 Key Management Client에서 암호화 키를 가져온 후, Client-Side Encryption을 위한 인스턴스를 생성합니다.

$clientEncryption = new ClientEncryption(

    [

        'key' => $encryptionKey,

        'collection' => 'encrypted_data',

        'keyAltName' => 'my_key',

    ]

);



// Client-Side Encryption을 위한 인스턴스에서 getKeys 메서드를 호출하여 암호화 키를 반환합니다.

$keys = $clientEncryption->getKeys();



// 반환된 암호화 키를 출력합니다.

print_r($keys);



주의

* 위 예제는 Client-Side Encryption을 위한 Key Management Client와 Client-Side Encryption을 위한 인스턴스를 생성하고, `getKeys` 메서드를 호출하여 암호화 키를 반환하는 예제입니다.
* Client-Side Encryption을 사용하려면 MongoDB Server에 연결하고, Client-Side Encryption을 위한 Key Management Client와 Client-Side Encryption을 위한 인스턴스를 생성해야 합니다.
* Client-Side Encryption을 사용하려면 MongoDB Server에서 Client-Side Encryption을 위한 Key Management Client와 Client-Side Encryption을 위한 인스턴스를 등록해야 합니다.

참고

* MongoDB Driver Client Encryption은 MongoDB Server 3.6 이상에서 사용할 수 있습니다.
* Client-Side Encryption을 사용하려면 MongoDB Server에서 Client-Side Encryption을 위한 Key Management Client와 Client-Side Encryption을 위한 인스턴스를 등록해야 합니다.
* Client-Side Encryption을 사용하려면 MongoDB Server에 연결하고, Client-Side Encryption을 위한 Key Management Client와 Client-Side Encryption을 위한 인스턴스를 생성해야 합니다.
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 10,077건 / 400 페이지

검색

게시물 검색