generated from ali/HarmonyTemplate
- Auth.ts: SERVICE_REQUEST handshake, none probe, publickey query + signed request (sig over string(session_id) || payload-without-signature; Ed25519 raw / ECDSA DER->mpint r||s / RSA PKCS1 SHA256/512), password fallback; skip-list wait loop (DISCONNECT/IGNORE/UNIMPLEMENTED/DEBUG/ EXT_INFO/BANNER); msg60 dual meaning handled per phase - Channel.ts: open/confirm, pty-req/shell/exec/window-change, chunked flow-controlled write, WINDOW_ADJUST at half local window, stderr via EXTENDED_DATA, exit-status, EOF/CLOSE lifecycle, per-channel promise slots (never overlaps transport.waitPacket) - KeepAlive.ts: keepalive@openssh.com global request every 15s, dead after 3 unanswered probes - SshSession.ts: state machine (IDLE..CLOSED), KEX with TOFU host key verify, post-auth dispatcher routes keepalive replies + channel packets, server channels/global requests refused, execCommand collects stdout/stderr/exitStatus - Transport.ts: fix stale waitPacket timer rejecting a fresh waiter (clear timer on resolve/reject/re-arm) - latent since T3, amplified by the T6 auth loop - DiagPage: username/password inputs + button 10 (connect -> auth -> exec 'echo haven-ok && uname -a')
825 lines
35 KiB
Plaintext
825 lines
35 KiB
Plaintext
/*
|
||
* Copyright (c) 2026 Haven for HarmonyOS contributors.
|
||
* Port of Haven by GlassHaven (AGPL-3.0). See LICENSE.
|
||
*
|
||
* T2 platform spike: verifies every platform capability the SSH stack needs
|
||
* (TCPSocket binary I/O, cryptoFramework algorithms, packet codec) against
|
||
* real servers and RFC test vectors.
|
||
*/
|
||
|
||
import { SshTransport, KexInitInfo } from '../ssh/Transport';
|
||
import { TcpRawSocket } from '../ssh/OhosTcpSocket';
|
||
import { packetCodecSelfTest, PacketCodec } from '../ssh/PacketCodec';
|
||
import { GcmPacketCipher, CtrMacPacketCipher } from '../ssh/Ciphers';
|
||
import { CryptoAdapter, RawKeyPair } from '../ssh/crypto/CryptoAdapter';
|
||
import { DerUtils, RsaPublicKeyParts, EcdsaParts } from '../ssh/crypto/DerUtils';
|
||
import { buildPublicKeyBlob, verifyHostKeySignature, PublicKeyMaterial } from '../ssh/crypto/KeyImport';
|
||
import { SshVersion, SshMsg } from '../ssh/SshTypes';
|
||
import { ClientProposals } from '../ssh/Algorithms';
|
||
import { KexEngine, KexResult, parseExtInfo } from '../ssh/Kex';
|
||
import { verifyHostKeyTofu, InMemoryKnownHostStore, HostKeyDecider, HostKeyPrompt,
|
||
HostKeyDecision, HostKeyStatus } from '../ssh/HostKeyVerifier';
|
||
import { SshSession, SshSessionOptions, ExecResult } from '../ssh/SshSession';
|
||
import { AuthResult } from '../ssh/Auth';
|
||
import { bytesToUtf8, utf8ToBytes, hexToBytes, bytesToHex, bytesEqual, concatBytes, SshWriter } from '../ssh/SshWire';
|
||
import { cryptoFramework } from '@kit.CryptoArchitectureKit';
|
||
import { BusinessError } from '@kit.BasicServicesKit';
|
||
|
||
@Entry
|
||
@Component
|
||
struct DiagPage {
|
||
@State host: string = '';
|
||
@State port: string = '22';
|
||
@State username: string = '';
|
||
@State password: string = '';
|
||
@State logText: string = '';
|
||
@State busy: boolean = false;
|
||
private scroller: Scroller = new Scroller();
|
||
|
||
build() {
|
||
Column({ space: 10 }) {
|
||
Row({ space: 10 }) {
|
||
Text('平台能力诊断')
|
||
.fontSize(20)
|
||
.fontWeight(FontWeight.Bold)
|
||
.layoutWeight(1)
|
||
Button('返回')
|
||
.fontSize(14)
|
||
.height(36)
|
||
.onClick(() => {
|
||
this.getUIContext().getRouter().back();
|
||
})
|
||
}
|
||
.width('100%')
|
||
|
||
Row({ space: 8 }) {
|
||
TextInput({ placeholder: 'SSH 服务器地址', text: this.host })
|
||
.layoutWeight(1)
|
||
.height(44)
|
||
.onChange((value: string) => {
|
||
this.host = value;
|
||
})
|
||
TextInput({ placeholder: '端口', text: this.port })
|
||
.width(90)
|
||
.height(44)
|
||
.type(InputType.Number)
|
||
.onChange((value: string) => {
|
||
this.port = value;
|
||
})
|
||
}
|
||
.width('100%')
|
||
|
||
Row({ space: 8 }) {
|
||
TextInput({ placeholder: '用户名', text: this.username })
|
||
.layoutWeight(1)
|
||
.height(44)
|
||
.onChange((value: string) => {
|
||
this.username = value;
|
||
})
|
||
TextInput({ placeholder: '密码', text: this.password })
|
||
.layoutWeight(1)
|
||
.height(44)
|
||
.type(InputType.Password)
|
||
.onChange((value: string) => {
|
||
this.password = value;
|
||
})
|
||
}
|
||
.width('100%')
|
||
|
||
Column({ space: 8 }) {
|
||
Button('1. TCP 连接与 SSH Banner')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testTcpBanner());
|
||
})
|
||
Button('2. AES-256-GCM 加解密往返')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testAesGcm());
|
||
})
|
||
Button('3. X25519 (RFC 7748 向量)')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testX25519());
|
||
})
|
||
Button('4. ECDH-P256 双向协商')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testEcdhP256());
|
||
})
|
||
Button('5. Ed25519 (RFC 8032) + RSA2048 签名')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testEd25519Rsa());
|
||
})
|
||
Button('6. SSH 版本交换 + KEXINIT 握手')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testKexInit());
|
||
})
|
||
Button('7. 二进制包编解码自测')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testPacketCodec());
|
||
})
|
||
Button('8. 加密套件自测 (RFC 向量)')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testCryptoSuite());
|
||
})
|
||
Button('9. 完整 KEX 密钥交换 (真实服务器)')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testLiveKex());
|
||
})
|
||
Button('10. 认证 + 执行命令 (用户名/密码)')
|
||
.width('100%')
|
||
.onClick(() => {
|
||
this.runTest((): Promise<void> => this.testLiveAuth());
|
||
})
|
||
}
|
||
.width('100%')
|
||
|
||
Scroll(this.scroller) {
|
||
Text(this.logText)
|
||
.fontSize(12)
|
||
.fontFamily('monospace')
|
||
.textAlign(TextAlign.Start)
|
||
.width('100%')
|
||
}
|
||
.layoutWeight(1)
|
||
.width('100%')
|
||
.backgroundColor('#f2f2f2')
|
||
.borderRadius(8)
|
||
.padding(8)
|
||
.edgeEffect(EdgeEffect.None)
|
||
}
|
||
.width('100%')
|
||
.height('100%')
|
||
.padding(14)
|
||
}
|
||
|
||
aboutToAppear(): void {
|
||
this.log('INFO', '诊断页就绪。填入服务器地址后逐项点击测试。');
|
||
}
|
||
|
||
private log(level: string, msg: string): void {
|
||
this.logText += `[${level}] ${msg}\n`;
|
||
if (this.logText.length > 16000) {
|
||
this.logText = this.logText.substring(this.logText.length - 12000);
|
||
}
|
||
this.scroller.scrollEdge(Edge.Bottom);
|
||
}
|
||
|
||
private runTest(test: () => Promise<void>): void {
|
||
if (this.busy) {
|
||
this.log('INFO', '有测试正在执行,请稍候…');
|
||
return;
|
||
}
|
||
this.busy = true;
|
||
const run: Promise<void> = test();
|
||
run.then((): void => {
|
||
this.busy = false;
|
||
}).catch((e: Object): void => {
|
||
const err = e as Error;
|
||
this.log('FAIL', `异常: ${err.message}`);
|
||
this.busy = false;
|
||
});
|
||
}
|
||
|
||
private parsePort(): number {
|
||
const p: number = parseInt(this.port);
|
||
if (isNaN(p) || p < 1 || p > 65535) {
|
||
return 22;
|
||
}
|
||
return p;
|
||
}
|
||
|
||
private trunc(s: string, max: number): string {
|
||
if (s.length <= max) {
|
||
return s;
|
||
}
|
||
return `${s.substring(0, max)}…`;
|
||
}
|
||
|
||
/** 1) TCP connect + first SSH banner line, binary-safe. */
|
||
private async testTcpBanner(): Promise<void> {
|
||
const host: string = this.host.trim();
|
||
if (host.length === 0) {
|
||
this.log('FAIL', '请先输入 SSH 服务器地址');
|
||
return;
|
||
}
|
||
const port: number = this.parsePort();
|
||
this.log('INFO', `连接 ${host}:${port} ...`);
|
||
const sock: TcpRawSocket = new TcpRawSocket();
|
||
try {
|
||
await sock.connect(host, port, 10000);
|
||
const banner: string = await this.readUntilNewline(sock, 8000);
|
||
const nl: number = banner.indexOf('\n');
|
||
const line: string = (nl >= 0 ? banner.substring(0, nl) : banner).replace('\r', '');
|
||
if (line.startsWith('SSH-')) {
|
||
this.log('PASS', `服务器 banner: ${line}`);
|
||
} else {
|
||
this.log('FAIL', `首行不是 SSH 版本串: ${this.trunc(line, 60)}`);
|
||
}
|
||
} finally {
|
||
sock.close();
|
||
}
|
||
}
|
||
|
||
private readUntilNewline(sock: TcpRawSocket, timeoutMs: number): Promise<string> {
|
||
return new Promise<string>((resolve: (s: string) => void, reject: (e: Error) => void): void => {
|
||
let acc: Uint8Array = new Uint8Array(0);
|
||
let settled: boolean = false;
|
||
sock.onData((chunk: Uint8Array): void => {
|
||
if (settled) {
|
||
return;
|
||
}
|
||
const merged: Uint8Array = new Uint8Array(acc.length + chunk.length);
|
||
merged.set(acc, 0);
|
||
merged.set(chunk, acc.length);
|
||
acc = merged;
|
||
for (let i = 0; i < acc.length; i++) {
|
||
if (acc[i] === 0x0a) {
|
||
settled = true;
|
||
resolve(bytesToUtf8(acc));
|
||
return;
|
||
}
|
||
}
|
||
if (acc.length > 4096) {
|
||
settled = true;
|
||
resolve(bytesToUtf8(acc));
|
||
}
|
||
});
|
||
sock.onClose((): void => {
|
||
if (!settled) {
|
||
settled = true;
|
||
reject(new Error('连接在收到 banner 前被关闭'));
|
||
}
|
||
});
|
||
setTimeout((): void => {
|
||
if (!settled) {
|
||
settled = true;
|
||
if (acc.length > 0) {
|
||
resolve(bytesToUtf8(acc));
|
||
} else {
|
||
reject(new Error('超时未收到任何数据'));
|
||
}
|
||
}
|
||
}, timeoutMs);
|
||
});
|
||
}
|
||
|
||
/** 2) AES-256-GCM round trip + tamper detection. */
|
||
private async testAesGcm(): Promise<void> {
|
||
const key: Uint8Array = await CryptoAdapter.randomBytes(32);
|
||
const iv: Uint8Array = await CryptoAdapter.randomBytes(12);
|
||
const plain: Uint8Array = utf8ToBytes('Haven AES-256-GCM round trip 0123456789 中文');
|
||
const aad: Uint8Array = utf8ToBytes('haven-diag-aad');
|
||
const sealed: Uint8Array = await CryptoAdapter.aesGcmEncrypt(key, iv, plain, aad);
|
||
if (sealed.length !== plain.length + 16) {
|
||
this.log('FAIL', `密文长度异常: ${sealed.length} (明文 ${plain.length} + 16 tag)`);
|
||
return;
|
||
}
|
||
this.log('INFO', `密文+tag ${bytesToHex(sealed.slice(0, 12))}...`);
|
||
const back: Uint8Array = await CryptoAdapter.aesGcmDecrypt(key, iv, sealed, aad);
|
||
if (!bytesEqual(back, plain)) {
|
||
this.log('FAIL', '解密结果与明文不一致');
|
||
return;
|
||
}
|
||
const tampered: Uint8Array = sealed.slice(0);
|
||
tampered[0] ^= 0xff;
|
||
let tamperDetected: boolean = false;
|
||
try {
|
||
await CryptoAdapter.aesGcmDecrypt(key, iv, tampered, aad);
|
||
} catch (e) {
|
||
tamperDetected = true;
|
||
}
|
||
if (!tamperDetected) {
|
||
this.log('FAIL', '篡改密文未被 GCM tag 校验拒绝');
|
||
return;
|
||
}
|
||
this.log('PASS', 'AES-256-GCM 往返一致,篡改被拒绝');
|
||
}
|
||
|
||
/** 3) X25519 agreement against RFC 7748 §6.1 test vectors. */
|
||
private async testX25519(): Promise<void> {
|
||
const alicePri: Uint8Array =
|
||
hexToBytes('77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a');
|
||
const bobPub: Uint8Array =
|
||
hexToBytes('de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f');
|
||
const bobPri: Uint8Array =
|
||
hexToBytes('5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb');
|
||
const alicePub: Uint8Array =
|
||
hexToBytes('8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a');
|
||
const want: Uint8Array =
|
||
hexToBytes('4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742');
|
||
const k1: Uint8Array = await CryptoAdapter.x25519Agreement(alicePri, bobPub);
|
||
const k2: Uint8Array = await CryptoAdapter.x25519Agreement(bobPri, alicePub);
|
||
if (!bytesEqual(k1, want) || !bytesEqual(k2, want)) {
|
||
this.log('FAIL', `X25519 共享密钥与向量不符: ${bytesToHex(k1)}`);
|
||
return;
|
||
}
|
||
this.log('PASS', `X25519 双向协商 = ${bytesToHex(k1.slice(0, 16))}...`);
|
||
}
|
||
|
||
/** 4) ECDH P-256: generate two pairs, cross-agree, expect equality. */
|
||
private async testEcdhP256(): Promise<void> {
|
||
const a: RawKeyPair = await CryptoAdapter.ecdhP256GenerateKeyPair();
|
||
const b: RawKeyPair = await CryptoAdapter.ecdhP256GenerateKeyPair();
|
||
if (a.pub.length !== 65 || a.pub[0] !== 0x04 || b.pub.length !== 65) {
|
||
this.log('FAIL', `公钥点格式异常 (len=${a.pub.length})`);
|
||
return;
|
||
}
|
||
const k1: Uint8Array = await CryptoAdapter.ecdhP256Agreement(a.pri, b.pub);
|
||
const k2: Uint8Array = await CryptoAdapter.ecdhP256Agreement(b.pri, a.pub);
|
||
if (!bytesEqual(k1, k2)) {
|
||
this.log('FAIL', 'ECDH-P256 双向协商结果不一致');
|
||
return;
|
||
}
|
||
this.log('PASS', `ECDH-P256 协商一致 (${k1.length}B): ${bytesToHex(k1.slice(0, 12))}...`);
|
||
}
|
||
|
||
/** 5) Ed25519 RFC 8032 TEST 1 + RSA2048 PKCS1-SHA256 round trip. */
|
||
private async testEd25519Rsa(): Promise<void> {
|
||
const pri: Uint8Array =
|
||
hexToBytes('9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60');
|
||
const pub: Uint8Array =
|
||
hexToBytes('d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a');
|
||
const wantSig: Uint8Array =
|
||
hexToBytes('e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b');
|
||
const empty: Uint8Array = new Uint8Array(0);
|
||
|
||
const sig: Uint8Array = await CryptoAdapter.ed25519Sign(pri, empty);
|
||
if (!bytesEqual(sig, wantSig)) {
|
||
this.log('FAIL', `Ed25519 签名与 RFC 8032 向量不符: ${bytesToHex(sig)}`);
|
||
return;
|
||
}
|
||
const ok: boolean = await CryptoAdapter.ed25519Verify(pub, empty, wantSig);
|
||
if (!ok) {
|
||
this.log('FAIL', 'Ed25519 向量验签失败');
|
||
return;
|
||
}
|
||
const badOk: boolean = await CryptoAdapter.ed25519Verify(pub, utf8ToBytes('x'), wantSig);
|
||
if (badOk) {
|
||
this.log('FAIL', 'Ed25519 对被篡改数据验签通过(不应发生)');
|
||
return;
|
||
}
|
||
this.log('PASS', 'Ed25519 签名=向量, 验签通过, 篡改被拒绝');
|
||
|
||
const pair: RawKeyPair = await CryptoAdapter.rsaGenerateKeyPair(2048);
|
||
this.log('INFO', `RSA2048 密钥 DER: pri ${pair.pri.length}B / pub ${pair.pub.length}B`);
|
||
const data: Uint8Array = utf8ToBytes('haven-rsa-pkcs1-sha256-roundtrip');
|
||
const rsig: Uint8Array = await CryptoAdapter.rsaSignPkcs1Sha256(pair.pri, data);
|
||
if (rsig.length !== 256) {
|
||
this.log('FAIL', `RSA 签名长度异常: ${rsig.length}`);
|
||
return;
|
||
}
|
||
const rok: boolean = await CryptoAdapter.rsaVerifyPkcs1Sha256(pair.pub, data, rsig);
|
||
if (!rok) {
|
||
this.log('FAIL', 'RSA 验签失败');
|
||
return;
|
||
}
|
||
this.log('PASS', 'RSA2048|PKCS1|SHA256 签名验签往返通过');
|
||
}
|
||
|
||
/** 6) Version exchange + KEXINIT with a real server (T3 acceptance). */
|
||
private async testKexInit(): Promise<void> {
|
||
const host: string = this.host.trim();
|
||
if (host.length === 0) {
|
||
this.log('FAIL', '请先输入 SSH 服务器地址');
|
||
return;
|
||
}
|
||
const port: number = this.parsePort();
|
||
this.log('INFO', `连接 ${host}:${port} 进行版本交换与 KEXINIT ...`);
|
||
const sock: TcpRawSocket = new TcpRawSocket();
|
||
const transport: SshTransport = new SshTransport(sock);
|
||
try {
|
||
await sock.connect(host, port, 10000);
|
||
const banner: string = await transport.start(SshVersion.CLIENT_BANNER, 15000);
|
||
this.log('INFO', `服务器版本: ${banner}`);
|
||
if (!banner.startsWith('SSH-2.0')) {
|
||
this.log('INFO', '注意: 对端未声明 SSH-2.0(老服务器可能无法继续)');
|
||
}
|
||
const cookie: Uint8Array = await CryptoAdapter.randomBytes(16);
|
||
await transport.sendPacket(transport.buildKexInit(cookie));
|
||
this.log('INFO', '已发送我方 KEXINIT');
|
||
const payload: Uint8Array = await transport.waitPacket(15000);
|
||
const info: KexInitInfo = transport.parseKexInit(payload);
|
||
this.log('INFO', `客户端 KEX: ${this.trunc(ClientProposals.kexAlgos.join(','), 64)}`);
|
||
this.log('INFO', `服务器 KEX: ${this.trunc(info.kexAlgos.join(','), 64)}`);
|
||
this.log('INFO', `服务器 HostKey: ${this.trunc(info.serverHostKeyAlgos.join(','), 64)}`);
|
||
this.log('INFO', `服务器 Cipher: ${this.trunc(info.encryptionC2s.join(','), 64)}`);
|
||
this.log('INFO', `服务器 MAC: ${this.trunc(info.macC2s.join(','), 64)}`);
|
||
this.log('INFO', `firstKexPacketFollows=${info.firstKexPacketFollows}, 出向序号=${transport.getOutSeq()}`);
|
||
this.log('PASS', '版本交换与 KEXINIT 解析完成');
|
||
} finally {
|
||
transport.close();
|
||
}
|
||
}
|
||
|
||
/** 7) Binary packet codec self test (sync logic wrapped for runTest). */
|
||
private async testPacketCodec(): Promise<void> {
|
||
const ok: boolean = packetCodecSelfTest();
|
||
if (ok) {
|
||
this.log('PASS', 'PacketCodec 自测通过(填充/分块/往返/GCM 分帧参数)');
|
||
} else {
|
||
this.log('FAIL', 'PacketCodec 自测失败');
|
||
}
|
||
}
|
||
|
||
/** 8) Crypto suite self test: RFC vectors, packet ciphers, KDF, DER, KeyImport. */
|
||
private async testCryptoSuite(): Promise<void> {
|
||
let pass: number = 0;
|
||
let fail: number = 0;
|
||
const check = (ok: boolean, name: string): void => {
|
||
if (ok) {
|
||
this.log('PASS', name);
|
||
pass += 1;
|
||
} else {
|
||
this.log('FAIL', name);
|
||
fail += 1;
|
||
}
|
||
};
|
||
|
||
// 1) HMAC RFC 4231 test case 1 (key = 0x0b x20, data = "Hi There")
|
||
const hmacKey: Uint8Array = new Uint8Array(20);
|
||
for (let i = 0; i < hmacKey.length; i++) {
|
||
hmacKey[i] = 0x0b;
|
||
}
|
||
const hmacData: Uint8Array = utf8ToBytes('Hi There');
|
||
const mac256: Uint8Array = CryptoAdapter.hmacSha256Sync(hmacKey, hmacData);
|
||
check(bytesToHex(mac256) === 'b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7',
|
||
'HMAC-SHA-256 RFC 4231 TC1');
|
||
const mac512: Uint8Array = CryptoAdapter.hmacSha512Sync(hmacKey, hmacData);
|
||
check(bytesToHex(mac512) === '87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854',
|
||
'HMAC-SHA-512 RFC 4231 TC1');
|
||
|
||
// 2) AES-128-CTR, NIST SP 800-38A F.5.5 (CTR-AES128.Encrypt)
|
||
const ctrKey: Uint8Array = hexToBytes('2b7e151628aed2a6abf7158809cf4f3c');
|
||
const ctrIv: Uint8Array = hexToBytes('f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff');
|
||
const ctr1: Uint8Array = CryptoAdapter.aesCtrCryptSync(ctrKey, ctrIv,
|
||
hexToBytes('6bc1bee22e409f96e93d7e117393172a'), cryptoFramework.CryptoMode.ENCRYPT_MODE);
|
||
check(bytesEqual(ctr1, hexToBytes('874d6191b620e3261bef6864990db6ce')),
|
||
'AES-128-CTR 单块 (NIST F.5.5)');
|
||
const ctr4: Uint8Array = CryptoAdapter.aesCtrCryptSync(ctrKey, ctrIv,
|
||
hexToBytes('6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710'),
|
||
cryptoFramework.CryptoMode.ENCRYPT_MODE);
|
||
check(bytesEqual(ctr4, hexToBytes('874d6191b620e3261bef6864990db6ce9806f66b7970fdff8617187bb9fffdff5ae4df3edbd5d35e5b4f09020db03eab1e031dda2fbe03d1792170a0f3009cee')),
|
||
'AES-128-CTR 4 块连续 (NIST F.5.5)');
|
||
|
||
// 3) GCM packet cipher: framing + byte-at-a-time round trip + tamper
|
||
const gcmKey: Uint8Array = await CryptoAdapter.randomBytes(32);
|
||
const gcmIvMat: Uint8Array = await CryptoAdapter.randomBytes(16);
|
||
const gcmEnc: GcmPacketCipher = new GcmPacketCipher(gcmKey, gcmIvMat, 32);
|
||
const gcmDec: GcmPacketCipher = new GcmPacketCipher(gcmKey, gcmIvMat, 32);
|
||
const g1: Uint8Array = await CryptoAdapter.randomBytes(5);
|
||
const g2: Uint8Array = await CryptoAdapter.randomBytes(40);
|
||
const g3: Uint8Array = await CryptoAdapter.randomBytes(300);
|
||
const gw1: Uint8Array = gcmEnc.encryptToPacket(g1, 0);
|
||
const gw2: Uint8Array = gcmEnc.encryptToPacket(g2, 1);
|
||
const gw3: Uint8Array = gcmEnc.encryptToPacket(g3, 2);
|
||
let gcmFramingOk: boolean = true;
|
||
const gws: Uint8Array[] = [gw1, gw2, gw3];
|
||
for (let gi = 0; gi < gws.length; gi++) {
|
||
const w: Uint8Array = gws[gi];
|
||
const plen: number = ((w[0] * 256 + w[1]) * 256 + w[2]) * 256 + w[3];
|
||
if (plen % 16 !== 0 || plen < 16 || plen > 1048576 || w.length !== 4 + plen + 16) {
|
||
gcmFramingOk = false;
|
||
}
|
||
}
|
||
check(gcmFramingOk, 'GCM 分帧: 明文长度字段 + packet_length%16==0 + 总长 4+len+16');
|
||
const gcmCodec: PacketCodec = new PacketCodec();
|
||
gcmCodec.setInCipher(gcmDec);
|
||
const gcmStream: Uint8Array = concatBytes(concatBytes(gw1, gw2), gw3);
|
||
let gcmCount: number = 0;
|
||
let gcmRoundOk: boolean = true;
|
||
for (let bi = 0; bi < gcmStream.length; bi++) {
|
||
gcmCodec.pushBytes(gcmStream.slice(bi, bi + 1));
|
||
let draining: boolean = true;
|
||
while (draining) {
|
||
const p: Uint8Array | undefined = await gcmCodec.nextPacket();
|
||
if (p === undefined) {
|
||
draining = false;
|
||
} else {
|
||
gcmCount += 1;
|
||
const want: Uint8Array = gcmCount === 1 ? g1 : (gcmCount === 2 ? g2 : g3);
|
||
if (!bytesEqual(p, want)) {
|
||
gcmRoundOk = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
check(gcmRoundOk && gcmCount === 3, 'GCM 往返: 逐字节喂入 3 包, 调用计数器跨包连续');
|
||
const gcmTampered: Uint8Array = gw1.slice(0);
|
||
gcmTampered[10] ^= 0xff; // ciphertext byte
|
||
const gcmDecT: GcmPacketCipher = new GcmPacketCipher(gcmKey, gcmIvMat, 32);
|
||
let gcmTamperThrew: boolean = false;
|
||
try {
|
||
await gcmDecT.tryDecryptPacket(gcmTampered);
|
||
} catch (e) {
|
||
gcmTamperThrew = true;
|
||
}
|
||
check(gcmTamperThrew, 'GCM 篡改密文 → 认证失败抛出');
|
||
|
||
// 4) CTR + hmac-sha2-256 (plain MAC): 7-byte chunk feeding + MAC tamper
|
||
const cKey: Uint8Array = await CryptoAdapter.randomBytes(16);
|
||
const cIv: Uint8Array = await CryptoAdapter.randomBytes(16);
|
||
const cMac: Uint8Array = await CryptoAdapter.randomBytes(32);
|
||
const cEnc: CtrMacPacketCipher = new CtrMacPacketCipher(cKey, cIv, cMac, 32, false);
|
||
const cDec: CtrMacPacketCipher = new CtrMacPacketCipher(cKey, cIv, cMac, 32, false);
|
||
const c1: Uint8Array = await CryptoAdapter.randomBytes(5);
|
||
const c2: Uint8Array = await CryptoAdapter.randomBytes(40);
|
||
const c3: Uint8Array = await CryptoAdapter.randomBytes(300);
|
||
const cw1: Uint8Array = cEnc.encryptToPacket(c1, 0);
|
||
const cw2: Uint8Array = cEnc.encryptToPacket(c2, 1);
|
||
const cw3: Uint8Array = cEnc.encryptToPacket(c3, 2);
|
||
const cCodec: PacketCodec = new PacketCodec();
|
||
cCodec.setInCipher(cDec);
|
||
const cStream: Uint8Array = concatBytes(concatBytes(cw1, cw2), cw3);
|
||
let cCount: number = 0;
|
||
let cRoundOk: boolean = true;
|
||
let ci: number = 0;
|
||
while (ci < cStream.length) {
|
||
const cEnd: number = ci + 7 <= cStream.length ? ci + 7 : cStream.length;
|
||
cCodec.pushBytes(cStream.slice(ci, cEnd));
|
||
ci = cEnd;
|
||
let draining2: boolean = true;
|
||
while (draining2) {
|
||
const p2: Uint8Array | undefined = await cCodec.nextPacket();
|
||
if (p2 === undefined) {
|
||
draining2 = false;
|
||
} else {
|
||
cCount += 1;
|
||
const want2: Uint8Array = cCount === 1 ? c1 : (cCount === 2 ? c2 : c3);
|
||
if (!bytesEqual(p2, want2)) {
|
||
cRoundOk = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
check(cRoundOk && cCount === 3, 'CTR+hmac-sha2-256 往返: 7 字节分块(试解密缓存) + 跨包计数器连续');
|
||
const cTampered: Uint8Array = cw1.slice(0);
|
||
cTampered[cTampered.length - 1] ^= 0xff; // MAC byte
|
||
const cDecT: CtrMacPacketCipher = new CtrMacPacketCipher(cKey, cIv, cMac, 32, false);
|
||
let cTamperThrew: boolean = false;
|
||
try {
|
||
await cDecT.tryDecryptPacket(cTampered);
|
||
} catch (e) {
|
||
cTamperThrew = true;
|
||
}
|
||
check(cTamperThrew, 'CTR+plainMAC 篡改 MAC → 校验失败抛出');
|
||
|
||
// 5) CTR + hmac-sha2-512 etm variant + CT tamper
|
||
const eKey: Uint8Array = await CryptoAdapter.randomBytes(16);
|
||
const eIv: Uint8Array = await CryptoAdapter.randomBytes(16);
|
||
const eMac: Uint8Array = await CryptoAdapter.randomBytes(64);
|
||
const eEnc: CtrMacPacketCipher = new CtrMacPacketCipher(eKey, eIv, eMac, 64, true);
|
||
const eDec: CtrMacPacketCipher = new CtrMacPacketCipher(eKey, eIv, eMac, 64, true);
|
||
const e1: Uint8Array = await CryptoAdapter.randomBytes(9);
|
||
const e2: Uint8Array = await CryptoAdapter.randomBytes(70);
|
||
const e3: Uint8Array = await CryptoAdapter.randomBytes(256);
|
||
const ew1: Uint8Array = eEnc.encryptToPacket(e1, 0);
|
||
const ew2: Uint8Array = eEnc.encryptToPacket(e2, 1);
|
||
const ew3: Uint8Array = eEnc.encryptToPacket(e3, 2);
|
||
const eCodec: PacketCodec = new PacketCodec();
|
||
eCodec.setInCipher(eDec);
|
||
const eStream: Uint8Array = concatBytes(concatBytes(ew1, ew2), ew3);
|
||
let eCount: number = 0;
|
||
let eRoundOk: boolean = true;
|
||
for (let ei = 0; ei < eStream.length; ei++) {
|
||
eCodec.pushBytes(eStream.slice(ei, ei + 1));
|
||
let draining3: boolean = true;
|
||
while (draining3) {
|
||
const p3: Uint8Array | undefined = await eCodec.nextPacket();
|
||
if (p3 === undefined) {
|
||
draining3 = false;
|
||
} else {
|
||
eCount += 1;
|
||
const want3: Uint8Array = eCount === 1 ? e1 : (eCount === 2 ? e2 : e3);
|
||
if (!bytesEqual(p3, want3)) {
|
||
eRoundOk = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
check(eRoundOk && eCount === 3, 'CTR+hmac-sha2-512-etm 往返: 逐字节喂入 3 包');
|
||
const eTampered: Uint8Array = ew1.slice(0);
|
||
eTampered[8] ^= 0xff; // ciphertext byte, MAC must catch it before decrypt
|
||
const eDecT: CtrMacPacketCipher = new CtrMacPacketCipher(eKey, eIv, eMac, 64, true);
|
||
let eTamperThrew: boolean = false;
|
||
try {
|
||
await eDecT.tryDecryptPacket(eTampered);
|
||
} catch (e) {
|
||
eTamperThrew = true;
|
||
}
|
||
check(eTamperThrew, 'CTR+etm 篡改密文 → MAC 优先校验抛出');
|
||
|
||
// 6) KDF expansion (RFC 4253 §7.2): determinism, length, chain structure
|
||
const kK: Uint8Array = await CryptoAdapter.randomBytes(32);
|
||
const kH: Uint8Array = await CryptoAdapter.randomBytes(32);
|
||
const kSid: Uint8Array = await CryptoAdapter.randomBytes(32);
|
||
const ex1: Uint8Array = CryptoAdapter.expandKey('SHA256', kK, kH, 'C', kSid, 80);
|
||
const ex2: Uint8Array = CryptoAdapter.expandKey('SHA256', kK, kH, 'C', kSid, 80);
|
||
check(ex1.length === 80 && bytesEqual(ex1, ex2), 'expandKey 确定性 + 截断至 80 字节');
|
||
const k1: Uint8Array = CryptoAdapter.sha256Sync(
|
||
concatBytes(concatBytes(concatBytes(kK, kH), utf8ToBytes('C')), kSid));
|
||
check(bytesEqual(ex1.slice(0, 32), k1), 'expandKey K1 = HASH(k||h||letter||sessionId)');
|
||
const k2: Uint8Array = CryptoAdapter.sha256Sync(concatBytes(concatBytes(kK, kH), k1));
|
||
check(bytesEqual(ex1.slice(32, 64), k2), 'expandKey K2 = HASH(k||h||K1) 链式正确');
|
||
|
||
// 7) RSA: SPKI parse/rebuild + sync sign/verify + ssh-rsa(SHA1) probe
|
||
const rsaPair: RawKeyPair = CryptoAdapter.rsaGenerateKeyPairSync(2048);
|
||
const rsaParts: RsaPublicKeyParts = DerUtils.parseRsaSpki(rsaPair.pub);
|
||
const rsaRebuilt: Uint8Array = DerUtils.buildRsaSpki(rsaParts.e, rsaParts.n);
|
||
check(bytesEqual(rsaRebuilt, rsaPair.pub) && rsaParts.n.length === 256,
|
||
'RSA SPKI 解析→重建与原始 DER 一致 (modulus 256B)');
|
||
const rsaData: Uint8Array = utf8ToBytes('haven-t4-rsa-pkcs1-roundtrip');
|
||
const rsaSig: Uint8Array = CryptoAdapter.rsaSignPkcs1Sync(rsaPair.pri, rsaData, 'SHA256');
|
||
const rsaOk: boolean = CryptoAdapter.rsaVerifyPkcs1Sync(rsaPair.pub, rsaData, rsaSig, 'SHA256');
|
||
check(rsaOk && rsaSig.length === 256, 'RSA2048|PKCS1|SHA256 同步签名验签');
|
||
try {
|
||
const sigSha1: Uint8Array = CryptoAdapter.rsaSignPkcs1Sync(rsaPair.pri, rsaData, 'SHA1');
|
||
const okSha1: boolean = CryptoAdapter.rsaVerifyPkcs1Sync(rsaPair.pub, rsaData, sigSha1, 'SHA1');
|
||
check(okSha1, 'RSA2048|PKCS1|SHA1 (ssh-rsa) 签名验签');
|
||
} catch (e) {
|
||
const be: BusinessError = e as BusinessError;
|
||
if (be.code === 801) {
|
||
this.log('INFO', 'ssh-rsa(SHA1) 不受支持 (code 801),将在 T5 移除 ssh-rsa 提案');
|
||
} else {
|
||
this.log('FAIL', `ssh-rsa(SHA1) 异常 code=${be.code}: ${be.message}(将在 T5 评估移除 ssh-rsa 提案)`);
|
||
fail += 1;
|
||
}
|
||
}
|
||
|
||
// 8) ECDSA: sign → DER parse → rebuild → verify (validates OH sig format)
|
||
const ecPair: RawKeyPair = CryptoAdapter.ecdsaP256GenerateKeyPairSync();
|
||
const ecData: Uint8Array = utf8ToBytes('haven-t4-ecdsa-roundtrip');
|
||
const ecSig: Uint8Array = CryptoAdapter.ecdsaP256SignSync(ecPair.pri, ecData);
|
||
const ecParts: EcdsaParts = DerUtils.ecdsaPartsFromDer(ecSig);
|
||
const ecRebuilt: Uint8Array = DerUtils.ecdsaDerFromParts(ecParts.r, ecParts.s);
|
||
const ecOk: boolean = CryptoAdapter.ecdsaP256VerifySync(ecPair.pub, ecData, ecRebuilt);
|
||
check(ecOk, 'ECDSA-P256 签名 DER 解析→重建→验签 (验证 OH 输出格式假设)');
|
||
const ecOk2: boolean = CryptoAdapter.ecdsaP256VerifySync(ecPair.pub, ecData, ecSig);
|
||
check(ecOk2, 'ECDSA-P256 原始签名直接验签');
|
||
|
||
// 9) KeyImport: SSH blob format + verifyHostKeySignature, all families
|
||
const edPub: Uint8Array = hexToBytes('d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a');
|
||
const edPri: Uint8Array = hexToBytes('9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60');
|
||
const hostData: Uint8Array = utf8ToBytes('haven-t4-hostkey-exchange-hash');
|
||
const edSig: Uint8Array = await CryptoAdapter.ed25519Sign(edPri, hostData);
|
||
const edMat: PublicKeyMaterial = { algo: 'ssh-ed25519', ed25519Pub: edPub };
|
||
const edBlob: Uint8Array = buildPublicKeyBlob('ssh-ed25519', edMat);
|
||
const edSigW: SshWriter = new SshWriter(96);
|
||
edSigW.writeString('ssh-ed25519');
|
||
edSigW.writeStringBytes(edSig);
|
||
check(verifyHostKeySignature('ssh-ed25519', edBlob, hostData, edSigW.toBytes()),
|
||
'KeyImport ssh-ed25519 主机密钥验签 (RFC 8032 TEST 1 密钥)');
|
||
check(!verifyHostKeySignature('ssh-ed25519', edBlob, utf8ToBytes('tampered'), edSigW.toBytes()),
|
||
'KeyImport ssh-ed25519 篡改 H → 验签拒绝');
|
||
const ecSig2: Uint8Array = CryptoAdapter.ecdsaP256SignSync(ecPair.pri, hostData);
|
||
const ecParts2: EcdsaParts = DerUtils.ecdsaPartsFromDer(ecSig2);
|
||
const ecInner: SshWriter = new SshWriter(80);
|
||
ecInner.writeMpint(ecParts2.r);
|
||
ecInner.writeMpint(ecParts2.s);
|
||
const ecMat: PublicKeyMaterial = { algo: 'ecdsa-sha2-nistp256', ecPoint: ecPair.pub };
|
||
const ecBlob: Uint8Array = buildPublicKeyBlob('ecdsa-sha2-nistp256', ecMat);
|
||
const ecSigW: SshWriter = new SshWriter(96);
|
||
ecSigW.writeString('ecdsa-sha2-nistp256');
|
||
ecSigW.writeStringBytes(ecInner.toBytes());
|
||
check(verifyHostKeySignature('ecdsa-sha2-nistp256', ecBlob, hostData, ecSigW.toBytes()),
|
||
'KeyImport ecdsa-sha2-nistp256 主机密钥验签 (SSH mpint r||s)');
|
||
const rsaMat: PublicKeyMaterial = { algo: 'ssh-rsa', rsaE: rsaParts.e, rsaN: rsaParts.n };
|
||
const rsaBlob: Uint8Array = buildPublicKeyBlob('rsa-sha2-256', rsaMat);
|
||
const rsaSigW: SshWriter = new SshWriter(320);
|
||
rsaSigW.writeString('rsa-sha2-256');
|
||
rsaSigW.writeStringBytes(rsaSig);
|
||
check(verifyHostKeySignature('rsa-sha2-256', rsaBlob, rsaData, rsaSigW.toBytes()),
|
||
'KeyImport rsa-sha2-256 主机密钥验签 (blob 内名 ssh-rsa)');
|
||
|
||
// summary
|
||
const total: number = pass + fail;
|
||
if (fail === 0) {
|
||
this.log('PASS', `加密套件自测 ${pass}/${total}`);
|
||
} else {
|
||
this.log('FAIL', `加密套件自测 ${pass}/${total},${fail} 项失败`);
|
||
}
|
||
}
|
||
|
||
/** 9) Full KEX against a live server: negotiate → agree → verify → NEWKEYS. */
|
||
private async testLiveKex(): Promise<void> {
|
||
const host: string = this.host.trim();
|
||
if (host.length === 0) {
|
||
this.log('FAIL', '请先输入 SSH 服务器地址');
|
||
return;
|
||
}
|
||
const port: number = this.parsePort();
|
||
this.log('INFO', `连接 ${host}:${port} 进行完整 KEX 密钥交换 ...`);
|
||
const socket: TcpRawSocket = new TcpRawSocket();
|
||
const transport: SshTransport = new SshTransport(socket);
|
||
try {
|
||
await socket.connect(host, port, 10000);
|
||
const serverBanner: string = await transport.start(SshVersion.CLIENT_BANNER, 15000);
|
||
this.log('INFO', `服务器版本: ${serverBanner}`);
|
||
|
||
// Fresh in-memory store per run → every test sees status 'new'.
|
||
const store: InMemoryKnownHostStore = new InMemoryKnownHostStore();
|
||
const decider: HostKeyDecider = {
|
||
decide: async (prompt: HostKeyPrompt): Promise<HostKeyDecision> => {
|
||
this.log('INFO', `主机密钥 [${prompt.status}] ${prompt.hostPort} (${prompt.keyAlgo})`);
|
||
this.log('INFO', `本次指纹: ${prompt.fingerprint}`);
|
||
if (prompt.status === HostKeyStatus.CHANGED) {
|
||
for (let i = 0; i < prompt.knownFingerprints.length; i++) {
|
||
this.log('INFO', `已知指纹 ${i + 1}: ${prompt.knownFingerprints[i]}`);
|
||
}
|
||
}
|
||
return HostKeyDecision.ACCEPT_ONCE;
|
||
}
|
||
};
|
||
const engine: KexEngine = new KexEngine(transport,
|
||
(algo: string, blob: Uint8Array, fp: string): Promise<boolean> => {
|
||
this.log('INFO', `校验主机密钥: ${algo} / ${fp}`);
|
||
// Rejection rejects this promise → run() aborts with the reason.
|
||
return verifyHostKeyTofu(store, decider, host, port, algo, blob)
|
||
.then((): boolean => true);
|
||
});
|
||
|
||
const result: KexResult = await engine.run(SshVersion.CLIENT_BANNER, serverBanner, 20000);
|
||
this.log('INFO', `kex: ${result.negotiated.kex}`);
|
||
this.log('INFO', `hostKeyAlgo: ${result.negotiated.hostKeyAlgo}`);
|
||
this.log('INFO', `cipherC2s: ${result.negotiated.cipherC2s}`);
|
||
this.log('INFO', `cipherS2c: ${result.negotiated.cipherS2c}`);
|
||
this.log('INFO', `macC2s: ${result.negotiated.macC2s.length > 0 ? result.negotiated.macC2s : 'implicit (AEAD)'}`);
|
||
this.log('INFO', `macS2c: ${result.negotiated.macS2c.length > 0 ? result.negotiated.macS2c : 'implicit (AEAD)'}`);
|
||
this.log('INFO', `strictKex: ${result.strictKex}`);
|
||
this.log('INFO', `extInfoExpected: ${result.extInfoExpected}`);
|
||
this.log('INFO', `hostKeyFingerprint: ${result.hostKeyFingerprint}`);
|
||
this.log('INFO', `sessionId: ${bytesToHex(result.sessionId)}`);
|
||
|
||
if (result.extInfoExpected) {
|
||
try {
|
||
const p: Uint8Array = await transport.waitPacket(2000);
|
||
if (p[0] === SshMsg.EXT_INFO) {
|
||
const ext: Map<string, string> = parseExtInfo(p);
|
||
this.log('INFO', `EXT_INFO (${ext.size} 项扩展):`);
|
||
ext.forEach((value: string, name: string): void => {
|
||
this.log('INFO', ` ${name} = ${this.trunc(value, 80)}`);
|
||
});
|
||
} else {
|
||
this.log('INFO', `KEX 后消息 ${p[0]} 忽略`);
|
||
}
|
||
} catch (e) {
|
||
this.log('INFO', '2 秒内未收到 EXT_INFO (ok)');
|
||
}
|
||
}
|
||
this.log('PASS', 'KEX 完成 ✓');
|
||
} finally {
|
||
transport.close();
|
||
}
|
||
}
|
||
|
||
/** 10) Full session: connect → KEX (TOFU) → password auth → exec. */
|
||
private async testLiveAuth(): Promise<void> {
|
||
const host: string = this.host.trim();
|
||
if (host.length === 0) {
|
||
this.log('FAIL', '请先输入 SSH 服务器地址');
|
||
return;
|
||
}
|
||
const username: string = this.username.trim();
|
||
if (username.length === 0) {
|
||
this.log('FAIL', '请先输入用户名');
|
||
return;
|
||
}
|
||
const port: number = this.parsePort();
|
||
this.log('INFO', `连接 ${host}:${port} → KEX → 认证 → exec ...`);
|
||
const store: InMemoryKnownHostStore = new InMemoryKnownHostStore();
|
||
const decider: HostKeyDecider = {
|
||
decide: async (prompt: HostKeyPrompt): Promise<HostKeyDecision> => {
|
||
this.log('INFO', `主机密钥 [${prompt.status}] ${prompt.hostPort} (${prompt.keyAlgo})`);
|
||
this.log('INFO', `指纹: ${prompt.fingerprint}`);
|
||
return HostKeyDecision.ACCEPT_ONCE;
|
||
}
|
||
};
|
||
const options: SshSessionOptions = {
|
||
knownHostStore: store,
|
||
hostKeyDecider: decider
|
||
};
|
||
const session: SshSession = new SshSession(options);
|
||
try {
|
||
await session.connect(host, port);
|
||
this.log('INFO', 'KEX 完成,开始认证 ...');
|
||
const auth: AuthResult = await session.authenticate(username, this.password, null);
|
||
this.log('INFO', `认证成功 (方式: ${auth.method})`);
|
||
const result: ExecResult = await session.execCommand('echo haven-ok && uname -a', 15000);
|
||
this.log('INFO', `exitStatus: ${result.exitStatus}`);
|
||
this.log('INFO', `stdout: ${this.trunc(result.stdout, 200)}`);
|
||
if (result.stderr.length > 0) {
|
||
this.log('INFO', `stderr: ${this.trunc(result.stderr, 200)}`);
|
||
}
|
||
this.log('PASS', '完整会话流程通过 ✓');
|
||
} finally {
|
||
session.close();
|
||
}
|
||
}
|
||
}
|