/**
   * Gets the decrypted literal string value of the data using the key provided by the security
   * manager.
   *
   * @param securityManager security manager associated with parent document.
   */
  public String getDecryptedLiteralString(SecurityManager securityManager) {
    // get the security manager instance
    if (securityManager != null && reference != null) {
      // get the key
      byte[] key = securityManager.getDecryptionKey();

      // convert string to bytes.
      byte[] textBytes = Utils.convertByteCharSequenceToByteArray(stringData);

      // Decrypt String
      textBytes = securityManager.decrypt(reference, key, textBytes);

      // convert back to a string
      return Utils.convertByteArrayToByteString(textBytes);
    }
    return getLiteralString();
  }
예제 #2
0
  public synchronized void init() {
    if (inited) {
      return;
    }

    byte[] in;
    try {
      stream.init();
      in = stream.getDecodedStreamBytes(0);
      if (logger.isLoggable(Level.FINEST)) {
        String content = Utils.convertByteArrayToByteString(in);
        logger.finest("Content = " + content);
      }
      if (in != null) {
        ICC_Profile profile = ICC_Profile.getInstance(in);
        colorSpace = new ICC_ColorSpace(profile);
      }
    } catch (Exception e) {
      logger.log(Level.FINE, "Error Processing ICCBased Colour Profile", e);
    }
    inited = true;
  }