0

I wrote this ASN.1 description

Demo-module DEFINITIONS ::=       -- Module-name DEFINITIONS ::= BEGIN

BEGIN

ClientFirstRequest ::= SEQUENCE {                  
   clientInt     INTEGER
}        

ServerFirstResponse ::= SEQUENCE {                
   serverInt    INTEGER ,        
   serverString     IA5String  
 }  

ClientSecondRequest ::= SEQUENCE {                  
   clientString     IA5String
}    

ServerSecondResponse ::= SEQUENCE {                
   serverResponse     IA5String
}  



END                                      -- end of module, END required

I have a code who send an integer to a server , it work perfectly

DataOutputStream dos = new DataOutputStream(_socket.getOutputStream());
 dos.writeInt(4);

But I tried to use the ASN.1 classes and i have a problem, I tried the following code, but I have an error in the setValue method

ClientFirstRequest h = new ClientFirstRequest();
        h.setValue(4);
        BerOutputStream bos = new BerOutputStream(_socket.getOutputStream());
         h.encode(bos);

enter image description here

4

1 回答 1

0

这看起来像是您应该向您正在使用的 ASN.1 工具的供应商提出的问题。每个 ASN.1 工具都有自己的方式将您的值转换为编码的字节流,即使所有 ASN.1 工具的结果字节流应该是相同的。您尚未指明您正在使用哪些 ASN.1 工具。

于 2013-05-21T19:37:53.130 回答