*
* If the content type is <code>Data</code> then there is no problem
* because we can simply grab the contents octets from it.
*/
public void update() throws GeneralSecurityException {
ASN1Type t;
boolean tagging;
t = target_.getContent();
if (t == null) {
return;
}
if (t instanceof Data) {
update(((Data) t).getByteArray());
return;
}
ByteArrayOutputStream bos;
DEREncoder enc;
/*
* We know it must be EXPLICIT but hey...
*/
tagging = t.isExplicit();
bos = new ByteArrayOutputStream();
enc = new DEREncoder(bos);
if (this.strict)
enc.setStrict(true);
try {
t.setExplicit(false);
enc.writeType(t);
update(bos.toByteArray());
} catch (Exception e) {
throw new SignatureException("Exception while re-encoding!");
} finally {
t.setExplicit(tagging);
try {
enc.close();
} catch (Exception e) {
}