CoAP セキュア
このモジュールには、CoAP Secure(DAP over DTLS)通信を制御する関数が含まれています。
概要
このモジュールの関数は、CoAP Secure API 機能(OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE
)が有効な場合に利用可能です。
Typedef |
|
---|---|
otHandleCoapSecureClientConnect)(bool aConnected, void *aContext)
|
typedefvoid(*
この関数ポインタは、DTLS 接続状態が変化したときに呼び出されます。 |
関数 |
|
---|---|
otCoapSecureAddBlockWiseResource(otInstance *aInstance, otCoapBlockwiseResource *aResource)
|
void
この関数は、ブロック単位のリソースを CoAP Secure サーバーに追加します。
|
otCoapSecureAddResource(otInstance *aInstance, otCoapResource *aResource)
|
void
この関数は、CoAP Secure サーバーにリソースを追加します。
|
otCoapSecureConnect(otInstance *aInstance, const otSockAddr *aSockAddr, otHandleCoapSecureClientConnect aHandler, void *aContext)
|
このメソッドは、ピアとの DTLS セッションを初期化します。
|
otCoapSecureDisconnect(otInstance *aInstance)
|
void
この方法で DTLS 接続が停止します。
|
otCoapSecureGetPeerCertificateBase64(otInstance *aInstance, unsigned char *aPeerCert, size_t *aCertLength, size_t aCertBufferSize)
|
このメソッドは、ピア x509 証明書の base64 エンコードを返します。
|
otCoapSecureIsConnected(otInstance *aInstance)
|
bool
このメソッドは、DTLS セッションが接続されているかどうかを示します。
|
otCoapSecureIsConnectionActive(otInstance *aInstance)
|
bool
このメソッドは、DTLS セッションがアクティブかどうかを示します。
|
otCoapSecureRemoveBlockWiseResource(otInstance *aInstance, otCoapBlockwiseResource *aResource)
|
void
この関数は、CoAP Secure サーバーからブロック単位のリソースを削除します。
|
otCoapSecureRemoveResource(otInstance *aInstance, otCoapResource *aResource)
|
void
この関数は、CoAP Secure サーバーからリソースを削除します。
|
otCoapSecureSendRequest(otInstance *aInstance, otMessage *aMessage, otCoapResponseHandler aHandler, void *aContext)
|
このメソッドは、安全な DTLS 接続を介して CoAP リクエストを送信します。
|
otCoapSecureSendRequestBlockWise(otInstance *aInstance, otMessage *aMessage, otCoapResponseHandler aHandler, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook)
|
このメソッドは、安全な DTLS 接続を介してブロック単位で CoAP リクエストを送信します。
|
otCoapSecureSendResponse(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
この関数は、CoAP Secure サーバーから CoAP レスポンスを送信します。
|
otCoapSecureSendResponseBlockWise(otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook)
|
この関数は、CoAP セキュア サーバーからブロックごとに CoAP レスポンスを送信します。
|
otCoapSecureSetCaCertificateChain(otInstance *aInstance, const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength)
|
void
このメソッドは、信頼できるトップレベル CA を設定します。
|
otCoapSecureSetCertificate(otInstance *aInstance, const uint8_t *aX509Cert, uint32_t aX509Length, const uint8_t *aPrivateKey, uint32_t aPrivateKeyLength)
|
void
このメソッドは、DTLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 の DTLS セッションに対応する、ローカル デバイスの X509 証明書に対応する秘密鍵を設定します。
|
otCoapSecureSetClientConnectedCallback(otInstance *aInstance, otHandleCoapSecureClientConnect aHandler, void *aContext)
|
void
このメソッドは、クライアントが CoAP セキュア サーバーに接続したときに、接続するコールバックを設定します。
|
otCoapSecureSetDefaultHandler(otInstance *aInstance, otCoapRequestHandler aHandler, void *aContext)
|
void
この関数は、未処理の CoAP セキュア リクエストのデフォルト ハンドラを設定します。
|
otCoapSecureSetPsk(otInstance *aInstance, const uint8_t *aPsk, uint16_t aPskLength, const uint8_t *aPskIdentity, uint16_t aPskIdLength)
|
void
このメソッドは、事前共有キー(PSK)と暗号スイート DTLS_PSK_WITH_AES_128_CCM_8 を設定します。
|
otCoapSecureSetSslAuthMode(otInstance *aInstance, bool aVerifyPeerCertificate)
|
void
このメソッドは、coap セキュア接続の認証モードを設定します。
|
otCoapSecureStart(otInstance *aInstance, uint16_t aPort)
|
この関数は、CoAP Secure サービスを開始します。
|
otCoapSecureStop(otInstance *aInstance)
|
void
この関数は CoAP セキュア サーバーを停止します。
|
Typedef
otHandleCoapSecureClientConnect
void(* otHandleCoapSecureClientConnect)(bool aConnected, void *aContext)
この関数ポインタは、DTLS 接続状態が変化したときに呼び出されます。
詳細 | |||||
---|---|---|---|---|---|
パラメータ |
|
関数
otCoapSecureAddBlockWiseResource
void otCoapSecureAddBlockWiseResource( otInstance *aInstance, otCoapBlockwiseResource *aResource )
この関数は、ブロック単位のリソースを CoAP Secure サーバーに追加します。
詳細 | |||||
---|---|---|---|---|---|
パラメータ |
|
otCoapSecureAddResource
void otCoapSecureAddResource( otInstance *aInstance, otCoapResource *aResource )
この関数は、CoAP Secure サーバーにリソースを追加します。
詳細 | |||||
---|---|---|---|---|---|
パラメータ |
|
OTCoapSecureConnect(英語)
otError otCoapSecureConnect( otInstance *aInstance, const otSockAddr *aSockAddr, otHandleCoapSecureClientConnect aHandler, void *aContext )
このメソッドは、ピアとの DTLS セッションを初期化します。
詳細 | |||||||||
---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
||||||||
戻り値 |
|
otCoapSecureDisconnect
void otCoapSecureDisconnect( otInstance *aInstance )
この方法で DTLS 接続が停止します。
詳細 | |||
---|---|---|---|
パラメータ |
|
otCoapSecureGetPeerCertificateBase64
otError otCoapSecureGetPeerCertificateBase64( otInstance *aInstance, unsigned char *aPeerCert, size_t *aCertLength, size_t aCertBufferSize )
このメソッドは、ピア x509 証明書の base64 エンコードを返します。
詳細 | |||||||||
---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
||||||||
戻り値 |
|
otCoapSecureIsConnected(オタク セキュア セキュア コネクテッド)
bool otCoapSecureIsConnected( otInstance *aInstance )
このメソッドは、DTLS セッションが接続されているかどうかを示します。
詳細 | |||||
---|---|---|---|---|---|
パラメータ |
|
||||
戻り値 |
|
otCoapSecureIsConnectionActive
bool otCoapSecureIsConnectionActive( otInstance *aInstance )
このメソッドは、DTLS セッションがアクティブかどうかを示します。
詳細 | |||||
---|---|---|---|---|---|
パラメータ |
|
||||
戻り値 |
|
otCoapSecureRemoveBlockWiseResource
void otCoapSecureRemoveBlockWiseResource( otInstance *aInstance, otCoapBlockwiseResource *aResource )
この関数は、CoAP Secure サーバーからブロック単位のリソースを削除します。
詳細 | |||||
---|---|---|---|---|---|
パラメータ |
|
otCoapSecureRemoveResource または
void otCoapSecureRemoveResource( otInstance *aInstance, otCoapResource *aResource )
この関数は、CoAP Secure サーバーからリソースを削除します。
詳細 | |||||
---|---|---|---|---|---|
パラメータ |
|
otCoapSecureSendRequest
otError otCoapSecureSendRequest( otInstance *aInstance, otMessage *aMessage, otCoapResponseHandler aHandler, void *aContext )
このメソッドは、安全な DTLS 接続を介して CoAP リクエストを送信します。
リクエストに対するレスポンスが期待される場合は、それぞれの関数とコンテキスト情報を提供する必要があります。応答が想定されていない場合、これらの引数は NULL ポインタでなければなりません。ヘッダーにメッセージ ID が設定されていない場合(0 に等しい)、この関数はそのメッセージに一意のメッセージ ID を割り当てます。
詳細 | |||||||||
---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
||||||||
戻り値 |
|
otCoapSecureSendRequestBlockWise(セキュア セキュア リクエスト ブロック Wise)
otError otCoapSecureSendRequestBlockWise( otInstance *aInstance, otMessage *aMessage, otCoapResponseHandler aHandler, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook, otCoapBlockwiseReceiveHook aReceiveHook )
このメソッドは、安全な DTLS 接続を介してブロック単位で CoAP リクエストを送信します。
この関数は、OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE 構成が有効な場合に利用可能です。
リクエストに対するレスポンスが期待される場合は、それぞれの関数とコンテキスト情報を提供する必要があります。応答が想定されていない場合、これらの引数は NULL ポインタでなければなりません。ヘッダーにメッセージ ID が設定されていない場合(0 に等しい)、この関数はそのメッセージに一意のメッセージ ID を割り当てます。
詳細 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
||||||||||||
戻り値 |
|
otCoapSecureSendResponse(英語)
otError otCoapSecureSendResponse( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo )
この関数は、CoAP Secure サーバーから CoAP レスポンスを送信します。
詳細 | |||||||
---|---|---|---|---|---|---|---|
パラメータ |
|
||||||
戻り値 |
|
otCoapSecureSendResponseBlockWise(セキュア コネクト レスポンス ブロック Wise)
otError otCoapSecureSendResponseBlockWise( otInstance *aInstance, otMessage *aMessage, const otMessageInfo *aMessageInfo, void *aContext, otCoapBlockwiseTransmitHook aTransmitHook )
この関数は、CoAP セキュア サーバーからブロックごとに CoAP レスポンスを送信します。
この関数は、OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE 構成が有効な場合に利用可能です。
詳細 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
||||||||||
戻り値 |
|
otCoapSecureSetCaCertificateChain
void otCoapSecureSetCaCertificateChain( otInstance *aInstance, const uint8_t *aX509CaCertificateChain, uint32_t aX509CaCertChainLength )
このメソッドは、信頼できるトップレベル CA を設定します。
これは、ピアの証明書を検証するために必要です。
Application CoAPS 用の DTLS モード「ECDHE ECDSA with AES 128 CCM 8」。
詳細 | |||||||
---|---|---|---|---|---|---|---|
パラメータ |
|
otCoapSecureSetCertificate
void otCoapSecureSetCertificate( otInstance *aInstance, const uint8_t *aX509Cert, uint32_t aX509Length, const uint8_t *aPrivateKey, uint32_t aPrivateKeyLength )
このメソッドは、DTLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 の DTLS セッションに対応する、ローカル デバイスの X509 証明書に対応する秘密鍵を設定します。
詳細 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
otCoapSecureSetClientConnectedCallback(コールバック)
void otCoapSecureSetClientConnectedCallback( otInstance *aInstance, otHandleCoapSecureClientConnect aHandler, void *aContext )
このメソッドは、クライアントが CoAP セキュア サーバーに接続したときに、接続するコールバックを設定します。
詳細 | |||||||
---|---|---|---|---|---|---|---|
パラメータ |
|
otCoapSecureSetDefaultHandler
void otCoapSecureSetDefaultHandler( otInstance *aInstance, otCoapRequestHandler aHandler, void *aContext )
この関数は、未処理の CoAP セキュア リクエストのデフォルト ハンドラを設定します。
詳細 | |||||||
---|---|---|---|---|---|---|---|
パラメータ |
|
otCoapSecureSetPsk
void otCoapSecureSetPsk( otInstance *aInstance, const uint8_t *aPsk, uint16_t aPskLength, const uint8_t *aPskIdentity, uint16_t aPskIdLength )
このメソッドは、事前共有キー(PSK)と暗号スイート DTLS_PSK_WITH_AES_128_CCM_8 を設定します。
詳細 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
otCoapSecureSetSslAuthMode
void otCoapSecureSetSslAuthMode( otInstance *aInstance, bool aVerifyPeerCertificate )
このメソッドは、coap セキュア接続の認証モードを設定します。
ピア証明書の確認を有効または無効にします。開始前に呼び出す必要があります。
詳細 | |||||
---|---|---|---|---|---|
パラメータ |
|
otCoapSecureStart
otError otCoapSecureStart( otInstance *aInstance, uint16_t aPort )
この関数は、CoAP Secure サービスを開始します。
詳細 | |||||
---|---|---|---|---|---|
パラメータ |
|
||||
戻り値 |
|
OTCoapSecureStop(英語)
void otCoapSecureStop( otInstance *aInstance )
この関数は CoAP セキュア サーバーを停止します。
詳細 | |||
---|---|---|---|
パラメータ |
|
マクロ
OT_DEFAULT_COAP_SECURE_PORT
OT_DEFAULT_COAP_SECURE_PORT 5684
RFC 7252 で指定されているデフォルトの CoAP セキュアポート。
リソース
OpenThread API リファレンスのトピックは、GitHub で入手可能なソースコードに基づいています。 詳細またはドキュメントへの投稿については、リソースをご覧ください。