Romani
Romani

Reputation: 3241

Update original data in detached signature created by crypto.signText

I got the BASE64 encoded text by using crypto.signText method. but that dose not contain original to data which is signed.

can anyone tell me how to update that encoded text to attach data to it.

Upvotes: 1

Views: 446

Answers (1)

Romani
Romani

Reputation: 3241

Done.

CMSSignedData csd = new CMSSignedData(byteArr);

if (csd.getSignedContent() == null) {
            byte[] contentBytes;
            if (!isIE) {
                contentBytes = data.getBytes();
            } else {
                //UnicodeLittleUnmarked = Sixteen-bit Unicode Transformation Format, little-endian byte order 
                contentBytes = data.getBytes("UnicodeLittleUnmarked");
            }
            CMSProcessable cmsProcesableContent = new CMSProcessableByteArray(contentBytes);
            csd = new CMSSignedData(cmsProcesableContent, byteArr);
        }

Upvotes: 1

Related Questions