CipherContextRef(NativeCipher nc, long id, boolean encrypt) { super(nc, refQueue); this.id = id; this.encrypt = encrypt; refList.add(this); UcryptoProvider.debug("Resource: trace CipherCtxt " + this.id); drainRefQueueBounded(); }
void dispose(boolean doCancel) { refList.remove(this); try { if (doCancel) { UcryptoProvider.debug("Resource: cancel CipherCtxt " + id); int k = NativeCipher.nativeFinal(id, encrypt, null, 0); if (k < 0) { UcryptoProvider.debug( "Resource: error cancelling CipherCtxt " + id + " " + new UcryptoException(-k).getMessage()); } } else { UcryptoProvider.debug("Resource: untrace CipherCtxt " + id); } } finally { this.clear(); } }