code: public static CMSSignedData getSignedData(byte[] signature, byte[] data) throws GeneralSecurityException
      {
          CMSSignedData signedData;
          try {
              if (data != null) {
                  signedData = new CMSSignedData(new CMSProcessableByteArray(data), signature);
              } else {
                  signedData = new CMSSignedData(signature);
              }
          } catch (CMSException e) {
              throw new GeneralSecurityException("Unable to decode signature", e);
          }
          return signedData;
      }
docs: Build a Bouncy Castle {@link CMSSignedData} from bytes.
  
  @param signature the signature.
  @param data the data signed.
  @return a CMS signed data.
  @throws GeneralSecurityException if the signature could not be decoded.