ホーム › Security.Cryptography › NCRYPT_SSL_CIPHER_SUITE
NCRYPT_SSL_CIPHER_SUITE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwProtocol | DWORD | 4 | +0 | +0 | 対応するSSL/TLSプロトコルバージョンを示す値。 |
| dwCipherSuite | DWORD | 4 | +4 | +4 | 暗号スイートの識別番号。 |
| dwBaseCipherSuite | DWORD | 4 | +8 | +8 | 基底となる暗号スイートの識別番号。 |
| szCipherSuite | WCHAR | 128 | +12 | +12 | 暗号スイート名を示すワイド文字列(固定長)。 |
| szCipher | WCHAR | 128 | +140 | +140 | 暗号アルゴリズム名を示すワイド文字列(固定長)。 |
| dwCipherLen | DWORD | 4 | +268 | +268 | 暗号鍵長(ビット)。 |
| dwCipherBlockLen | DWORD | 4 | +272 | +272 | 暗号ブロック長(バイト)。 |
| szHash | WCHAR | 128 | +276 | +276 | ハッシュアルゴリズム名を示すワイド文字列(固定長)。 |
| dwHashLen | DWORD | 4 | +404 | +404 | ハッシュ値長(ビット)。 |
| szExchange | WCHAR | 128 | +408 | +408 | 鍵交換アルゴリズム名を示すワイド文字列(固定長)。 |
| dwMinExchangeLen | DWORD | 4 | +536 | +536 | 鍵交換鍵長の最小値(ビット)。 |
| dwMaxExchangeLen | DWORD | 4 | +540 | +540 | 鍵交換鍵長の最大値(ビット)。 |
| szCertificate | WCHAR | 128 | +544 | +544 | 証明書アルゴリズム名を示すワイド文字列(固定長)。 |
| dwKeyType | DWORD | 4 | +672 | +672 | 鍵の種別を示す値。 |
各言語での定義
#include <windows.h>
// NCRYPT_SSL_CIPHER_SUITE (x64 676 / x86 676 バイト)
typedef struct NCRYPT_SSL_CIPHER_SUITE {
DWORD dwProtocol;
DWORD dwCipherSuite;
DWORD dwBaseCipherSuite;
WCHAR szCipherSuite[64];
WCHAR szCipher[64];
DWORD dwCipherLen;
DWORD dwCipherBlockLen;
WCHAR szHash[64];
DWORD dwHashLen;
WCHAR szExchange[64];
DWORD dwMinExchangeLen;
DWORD dwMaxExchangeLen;
WCHAR szCertificate[64];
DWORD dwKeyType;
} NCRYPT_SSL_CIPHER_SUITE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NCRYPT_SSL_CIPHER_SUITE
{
public uint dwProtocol;
public uint dwCipherSuite;
public uint dwBaseCipherSuite;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szCipherSuite;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szCipher;
public uint dwCipherLen;
public uint dwCipherBlockLen;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szHash;
public uint dwHashLen;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szExchange;
public uint dwMinExchangeLen;
public uint dwMaxExchangeLen;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szCertificate;
public uint dwKeyType;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NCRYPT_SSL_CIPHER_SUITE
Public dwProtocol As UInteger
Public dwCipherSuite As UInteger
Public dwBaseCipherSuite As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szCipherSuite As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szCipher As String
Public dwCipherLen As UInteger
Public dwCipherBlockLen As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szHash As String
Public dwHashLen As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szExchange As String
Public dwMinExchangeLen As UInteger
Public dwMaxExchangeLen As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szCertificate As String
Public dwKeyType As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NCRYPT_SSL_CIPHER_SUITE(ctypes.Structure):
_fields_ = [
("dwProtocol", wintypes.DWORD),
("dwCipherSuite", wintypes.DWORD),
("dwBaseCipherSuite", wintypes.DWORD),
("szCipherSuite", ctypes.c_wchar * 64),
("szCipher", ctypes.c_wchar * 64),
("dwCipherLen", wintypes.DWORD),
("dwCipherBlockLen", wintypes.DWORD),
("szHash", ctypes.c_wchar * 64),
("dwHashLen", wintypes.DWORD),
("szExchange", ctypes.c_wchar * 64),
("dwMinExchangeLen", wintypes.DWORD),
("dwMaxExchangeLen", wintypes.DWORD),
("szCertificate", ctypes.c_wchar * 64),
("dwKeyType", wintypes.DWORD),
]#[repr(C)]
pub struct NCRYPT_SSL_CIPHER_SUITE {
pub dwProtocol: u32,
pub dwCipherSuite: u32,
pub dwBaseCipherSuite: u32,
pub szCipherSuite: [u16; 64],
pub szCipher: [u16; 64],
pub dwCipherLen: u32,
pub dwCipherBlockLen: u32,
pub szHash: [u16; 64],
pub dwHashLen: u32,
pub szExchange: [u16; 64],
pub dwMinExchangeLen: u32,
pub dwMaxExchangeLen: u32,
pub szCertificate: [u16; 64],
pub dwKeyType: u32,
}import "golang.org/x/sys/windows"
type NCRYPT_SSL_CIPHER_SUITE struct {
dwProtocol uint32
dwCipherSuite uint32
dwBaseCipherSuite uint32
szCipherSuite [64]uint16
szCipher [64]uint16
dwCipherLen uint32
dwCipherBlockLen uint32
szHash [64]uint16
dwHashLen uint32
szExchange [64]uint16
dwMinExchangeLen uint32
dwMaxExchangeLen uint32
szCertificate [64]uint16
dwKeyType uint32
}type
NCRYPT_SSL_CIPHER_SUITE = record
dwProtocol: DWORD;
dwCipherSuite: DWORD;
dwBaseCipherSuite: DWORD;
szCipherSuite: array[0..63] of WideChar;
szCipher: array[0..63] of WideChar;
dwCipherLen: DWORD;
dwCipherBlockLen: DWORD;
szHash: array[0..63] of WideChar;
dwHashLen: DWORD;
szExchange: array[0..63] of WideChar;
dwMinExchangeLen: DWORD;
dwMaxExchangeLen: DWORD;
szCertificate: array[0..63] of WideChar;
dwKeyType: DWORD;
end;const NCRYPT_SSL_CIPHER_SUITE = extern struct {
dwProtocol: u32,
dwCipherSuite: u32,
dwBaseCipherSuite: u32,
szCipherSuite: [64]u16,
szCipher: [64]u16,
dwCipherLen: u32,
dwCipherBlockLen: u32,
szHash: [64]u16,
dwHashLen: u32,
szExchange: [64]u16,
dwMinExchangeLen: u32,
dwMaxExchangeLen: u32,
szCertificate: [64]u16,
dwKeyType: u32,
};type
NCRYPT_SSL_CIPHER_SUITE {.bycopy.} = object
dwProtocol: uint32
dwCipherSuite: uint32
dwBaseCipherSuite: uint32
szCipherSuite: array[64, uint16]
szCipher: array[64, uint16]
dwCipherLen: uint32
dwCipherBlockLen: uint32
szHash: array[64, uint16]
dwHashLen: uint32
szExchange: array[64, uint16]
dwMinExchangeLen: uint32
dwMaxExchangeLen: uint32
szCertificate: array[64, uint16]
dwKeyType: uint32struct NCRYPT_SSL_CIPHER_SUITE
{
uint dwProtocol;
uint dwCipherSuite;
uint dwBaseCipherSuite;
wchar[64] szCipherSuite;
wchar[64] szCipher;
uint dwCipherLen;
uint dwCipherBlockLen;
wchar[64] szHash;
uint dwHashLen;
wchar[64] szExchange;
uint dwMinExchangeLen;
uint dwMaxExchangeLen;
wchar[64] szCertificate;
uint dwKeyType;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NCRYPT_SSL_CIPHER_SUITE サイズ: 676 バイト(x64)
dim st, 169 ; 4byte整数×169(構造体サイズ 676 / 4 切り上げ)
; dwProtocol : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwCipherSuite : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwBaseCipherSuite : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; szCipherSuite : WCHAR (+12, 128byte) varptr(st)+12 を基点に操作(128byte:入れ子/配列)
; szCipher : WCHAR (+140, 128byte) varptr(st)+140 を基点に操作(128byte:入れ子/配列)
; dwCipherLen : DWORD (+268, 4byte) st.67 = 値 / 値 = st.67 (lpoke/lpeek も可)
; dwCipherBlockLen : DWORD (+272, 4byte) st.68 = 値 / 値 = st.68 (lpoke/lpeek も可)
; szHash : WCHAR (+276, 128byte) varptr(st)+276 を基点に操作(128byte:入れ子/配列)
; dwHashLen : DWORD (+404, 4byte) st.101 = 値 / 値 = st.101 (lpoke/lpeek も可)
; szExchange : WCHAR (+408, 128byte) varptr(st)+408 を基点に操作(128byte:入れ子/配列)
; dwMinExchangeLen : DWORD (+536, 4byte) st.134 = 値 / 値 = st.134 (lpoke/lpeek も可)
; dwMaxExchangeLen : DWORD (+540, 4byte) st.135 = 値 / 値 = st.135 (lpoke/lpeek も可)
; szCertificate : WCHAR (+544, 128byte) varptr(st)+544 を基点に操作(128byte:入れ子/配列)
; dwKeyType : DWORD (+672, 4byte) st.168 = 値 / 値 = st.168 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NCRYPT_SSL_CIPHER_SUITE
#field int dwProtocol
#field int dwCipherSuite
#field int dwBaseCipherSuite
#field wchar szCipherSuite 64
#field wchar szCipher 64
#field int dwCipherLen
#field int dwCipherBlockLen
#field wchar szHash 64
#field int dwHashLen
#field wchar szExchange 64
#field int dwMinExchangeLen
#field int dwMaxExchangeLen
#field wchar szCertificate 64
#field int dwKeyType
#endstruct
stdim st, NCRYPT_SSL_CIPHER_SUITE ; NSTRUCT 変数を確保
st->dwProtocol = 100
mes "dwProtocol=" + st->dwProtocol