이 페이지에서

보안이 지원되는 OPC UA 클라이언트 만들기

OPC UA의 핵심 기능 중 하나는 보안 지원으로, 암호화된 암호화 및 서명 프로토콜, 사용자 인증 및 권한 부여를 지원한다는 의미입니다.

이를 위해서는 각 애플리케이션 인스턴스(프로그램 설치)에 고유한 Application Instance Certificate 및 해당 개인키가 있어야 합니다.

애플리케이션은 자체적으로 자체 서명된 인증서를 생성하거나( Qt OPC UA X509 지원 참조), OPC UA GDS를 사용하여 인증 기관에서 인증서를 받거나, 사용자가 수동으로 만든 인증서로 간단히 구성할 수 있습니다.

UA 애플리케이션 구성하기

클라이언트가 보안 연결을 사용하도록 하려면 다음을 수행해야 합니다.

  • 올바른 애플리케이션 ID를 구성합니다
    m_identity = m_pkiConfig.applicationIdentity();
  • SDK가 인증서, 개인 키, 신뢰 목록 등을 찾을 수 있도록 PKI 위치를 구성합니다.

    예를 들어 Qt OPC UA 뷰어 예제의 코드를 참조하세요:

    void MainWindow::setupPkiConfiguration() { const QDir pkidir =QDir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/pki"); if (!pkidir.exists() && !copyDirRecursively(":/pki", pkidir.path()))        qFatal("Could not set up directory %s!", qUtf8Printable(pkidir.path()));
    
        m_pkiConfig.setClientCertificateFile(pkidir.absoluteFilePath("own/certs/opcuaviewer.der")); m_pkiConfig.setPrivateKeyFile(pkidir.절대파일경로("own/private/opcuaviewer.pem")); m_pkiConfig.setTrustListDirectory(pkidir.absoluteFilePath("trusted/certs")); m_pkiConfig.setRevocationListDirectory(pkidir.absoluteFilePath("trusted/crl")); m_pkiConfig.setIssuerListDirectory(pkidir.absoluteFilePath("issuers/certs")); m_pkiConfig.setIssuerRevocationListDirectory(pkidir.absoluteFilePath("issuers/crl")); const QStringList toCreate = { m_pkiConfig.issuerListDirectory(),m_pkiConfig.issuerRevocationListDirectory() }; for(const QString &dir: toCreate) { if (!QDir().mkpath(dir))            qFatal("Could not create directory %s!", qUtf8Printable(dir));
        } }

    이 예에서는 미리 구성된 자체 및 신뢰할 수 있는 인증서를 Qt 리소스 시스템에서 파일 시스템의 쓰기 가능한 위치로 추출합니다. 발급자(해지) 목록의 나머지 디렉터리는 수동으로 만듭니다.

첫 번째 연결

처음 연결할 때 클라이언트는 서버 인증서를 신뢰해야 합니다.

클라이언트는 인증서 경고(인증서 상세 정보 포함)를 표시하고 인증서를 신뢰 목록에 저장할 수 있는 가능성을 제공해야 합니다. 예는 Qt OPC UA 뷰어 예시를 참조하세요.

클라이언트가 서버 인증서를 수락하면 다시 연결을 시도할 수 있습니다. 이제 서버가 클라이언트의 인증서를 거부할 수 있습니다. 이는 일반적인 오류 코드 BadSecurityChecksFailed 로 표시됩니다. 서버는 일반적으로 거부된 인증서를 특별한 rejected 폴더에 저장합니다. 관리자는 이 폴더를 신뢰 목록으로 이동하여 클라이언트를 신뢰할 수 있습니다. 이렇게 하면 클라이언트 인증서를 서버 컴퓨터로 수동으로 복사하지 않아도 됩니다.

서버가 클라이언트를 신뢰하면 곧바로 보안 연결을 할 수 있어야 합니다.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.