matlab运行错误类型,MATLAB运行错误

博主在使用Matlab运行信息安全相关的程序时遇到Java异常问题,具体表现为无法打开指定的FIFO文件。该程序涉及功耗分析及掩码方法,旨在进行AES256 RSM实现的攻击模拟。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本帖最后由 林芝有花 于 2014-4-24 16:15 编辑

运行老师给的matlab程序,关于信息安全的。相关性功耗分析和掩码方法。可是在自己的电脑里却不能运行出来。我第一次遇见时,以为是没装JDK的原因,可是装了也没有运行出来。我以为是java的原因,作死的卸载了java,结果傲娇的不能装新版本了!!!我想求大家帮忙看可不可以在你们的matlab运行出来啊,不要是这个方面出错大概就好了,快哭了。

程序:

%

% Framework for developping attacks in Matlab under Windows

% for the DPA contest V4, AES256 RSM implementation

%

% Requires the wrapper tool for Windows

%

% Version 1, 29/07/2013

%

% Guillaume Duc

%

% Number of the attacked subkey

% TODO: adapt it

attacked_subkey = 0;

% FIFO filenames (the last argument when launching the

% wrapper should be 'fifo')

fifo_in_filename = '\\.\pipe\fifo_from_wrapper';

fifo_out_filename = '\\.\pipe\fifo_to_wrapper';

% Open the two communication FIFO

% We have to use the Java interface as the native function fopen from

% Matlab is unable to open FIFO!

fifo_in = java.io.FileInputStream(fifo_in_filename);

fifo_out = java.io.FileOutputStream(fifo_out_filename);

% Retrieve the number of traces

num_traces_b = arrayfun(@(x) fifo_in.read(), 1:4);

num_traces = num_traces_b(4) * 2^24 + num_traces_b(3) * 2^16 + num_traces_b(2) * 2^8 + num_traces_b(1);

% Send start of attack string

fifo_out.write([10 46 10]);

% Main loop

for iteration = 1:num_traces

% Read trace

plaintext = arrayfun(@(x) fifo_in.read(), 1:16);

ciphertext = arrayfun(@(x) fifo_in.read(), 1:16);

offset = fifo_in.read();

samples = arrayfun(@(x) fifo_in.read(), 1:435002); % read samples as unsigned bytes

samples = arrayfun(@(x) typecast(uint8(x),'int8'), samples); % convert to signed bytes

% TODO: put your attack code here

%

% Your attack code can use:

% - plaintext: the plaintext

% - ciphertext: the ciphertext

% - offset: the offset (0 unless the wrapper is launched with --provide_offset_v4_rsm)

% - samples: the samples of the trace

%

% And must produce bytes which is a 256 lines x 16 columns array

% (matrix) where for each byte of the attacked subkey (the columns of

% the array), all the 256 possible values of this byte are sorted

% according to their probability (first position: most probable, last:

% least probable), i.e. if your attack is successful, the value of the

% key is the first line of the array.

bytes = repmat((0:255)', 1, 16);

% Send result

fifo_out.write(attacked_subkey);

fifo_out.write(bytes(:,1));

fifo_out.write(bytes(:,2));

fifo_out.write(bytes(:,3));

fifo_out.write(bytes(:,4));

fifo_out.write(bytes(:,5));

fifo_out.write(bytes(:,6));

fifo_out.write(bytes(:,7));

fifo_out.write(bytes(:,8));

fifo_out.write(bytes(:,9));

fifo_out.write(bytes(:,10));

fifo_out.write(bytes(:,11));

fifo_out.write(bytes(:,12));

fifo_out.write(bytes(:,13));

fifo_out.write(bytes(:,14));

fifo_out.write(bytes(:,15));

fifo_out.write(bytes(:,16));

end

% Close the two FIFOs

fifo_in.close();

fifo_out.close();

这是一个例子,不是完整的,但完整的代码也和它是一样的错误:

>> attack_windows

Java exception occurred:

java.io.FileNotFoundException: \\.\pipe\fifo_from_wrapper (系统找不到指定的文件。)

at java.io.FileInputStream.open(Native Method)

at java.io.FileInputStream.(Unknown Source)

at java.io.FileInputStream.(Unknown Source)

Error in attack_windows (line 28)

fifo_in = java.io.FileInputStream(fifo_in_filename);

我第一次遇见时,以为是没装JDK的原因,可是装了也没有运行出来。我以为是java的原因,作死的卸载了java,结果傲娇的不能装新版本了!!!我想求大家帮忙看可不可以在你们的matlab运行出来啊,不要是这个方面出错大概就好了,快哭了。

电脑window7,32位,装的R2012a。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值