1
我使用的CMSAuthenticatedData从充气城堡库,版本146.我可以创建它正确,通过检查ASN.1转储验证,但我似乎无法到检索内容。检索充气城堡的CMSAuthenticatedData【JAVA]封装内容
的认证的数据对象与一个发生器产生,这样的:
CMSAuthenticatedDataGenerator generator = new CMSAuthenticatedDataGenerator();
CMSProcessableByteArray myContent = new CMSProcessableByteArray(myBytes);
CMSAuthenticatedData cmsData = generator.generate(myContent, myMacCalculator);
cmsData然后用.getEncoded(),向服务器发送串行化,并与字节[]构造反序列化。从RFC,我看到myBytes应该在AuthenticatedData对象内部encapContentInfo场,但我不能得到它。以下是我试过到目前为止:
// The original byte array I want to retrieve is 633 bytes long.
cmsData.getEncoded();
// returns ASN.1 for authData OID and AuthenticatedData object. Size: 724
cmsData.getContentInfo();
// Same as cmsData.getEncoded(). Size: 724
cmsData.getContentInfo().getContent().getDERObject().getEncoded();
// returns ASN.1 for AuthenticatedData object. Size: 703
所以,这是甚至可能的,或者我应该推出我自己的实现,解析ASN.1字节数组?