/
Clicking on Secure Macro throws Error

Clicking on Secure Macro throws Error

 Problem

Clicking the Secure Macro will throw an error, and it does not allow the decryption of secrets.

image-20240429-065335.png

It is not possible to edit the Macro itself when editing the page.

In the logs, the following can be found:

2024-04-29 06:54:42,729 ERROR [http-nio-8090-exec-2] [confluence.secenc.rest.SecureResource] checkUserPermission Could not decrypt secret due to : Could not decrypt data using encryption key due to : exception decrypting session info: block incorrect -- referer: http://192.168.0.193:9090/pages/resumedraft.action?draftId=27066531&draftShareId=052baf01-c839-41ed-99b7-7b5e7ea6551d& | url: /rest/secenc/1.0/secure/permission/check.json | traceId: 778ecddbe497cba4 | userName: admin org.bouncycastle.openpgp.PGPException: Could not decrypt data using encryption key due to : exception decrypting session info: block incorrect at com.servicerocket.confluence.secenc.cipher.PgpServiceImpl.decrypt(PgpServiceImpl.java:118) at com.servicerocket.confluence.secenc.rest.SecureResource.checkUserPermission(SecureResource.java:328) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker.lambda$_dispatch$0(DispatchProviderHelper.java:181) at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.lambda$invokeMethodWithInterceptors$0(DispatchProviderHelper.java:81)

 Solution

The problem is caused by the PGP Encryption Key is no longer match with the affected Secure Macros. As the PGP Encryption Key is a unique key on every Confluence instance, the above will happen when:

  • The Confluence instance is migrated from another server.

  • The Secure Macro is copied from another Confluence instance.

Follow the article below to fix the issue: