Update original data in detached signature created by crypto.signText
-
10-10-2019 - |
Pergunta
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.
Solução
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);
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow