LibreOffice LibreOffice 25.2 SDK API Reference

Public Member Functions | List of all members
XPackageEncryption Interface Reference

Allows to transparently plug-in crypto for PackageStreams. More...

`import"XPackageEncryption.idl";`

Inheritance diagram for XPackageEncryption:

## Public Member Functions
boolean | readEncryptionInfo ([in] sequence< com::sun::star::beans::NamedValue > rStreams)
| Read package crypto information. More...
boolean | generateEncryptionKey ([in] string rPassword)
| Set or refresh encryption key. More...
boolean | decrypt ([in] com::sun::star::io::XInputStream rxInputStream, [out] com::sun::star::io::XOutputStream rxOutputStream)
| Decrypt document content. More...
sequence< com::sun::star::beans::NamedValue > | createEncryptionData ([in] string rPassword)
| Create key-value list of encryption meta data. More...
boolean | setupEncryption ([in] sequence< com::sun::star::beans::NamedValue > rMediaEncData)
| Set key-value list of encryption meta data. More...
sequence< com::sun::star::beans::NamedValue > | encrypt ([in] com::sun::star::io::XInputStream rxInputStream)
| Encrypt given stream. More...
boolean | checkDataIntegrity ()
| Check if decryption meta data is valid. More...
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...

## Detailed Description

Allows to transparently plug-in crypto for PackageStreams.

Since
  LibreOffice 7.0

## Member Function Documentation

## ◆ checkDataIntegrity()

boolean checkDataIntegrity | ( |  | ) |

Check if decryption meta data is valid.

Some implementations might for example check HMAC values here. Call this before trusting encrypted data.

Returns
  True if decryption algo setup finished without error and consistency checks have passed. False otherwise.

## ◆ createEncryptionData()

sequence< com::sun::star::beans::NamedValue > createEncryptionData | ( | [in] string | rPassword | ) |

Create key-value list of encryption meta data.

After generateEncryptionKey() succeeded in setting up crypto, use this method to create requisite meta data. Depending on underlying crypto, this can be a salt, init vector, or other algorithm-specific information that needs to be stored alongside an encrypted document

Parameters

  rPassword | Same password as provided to generateEncryptionKey

Returns
  Sequence of opaque key-value pairs needed for decrypting this setup. Can be passed back into other instances of this service via setupEncryption()

## ◆ decrypt()

boolean decrypt | ( | [in] com::sun::star::io::XInputStream | rxInputStream,
|  | [out] com::sun::star::io::XOutputStream | rxOutputStream
| ) |  |

Decrypt document content.

After crypto setup via readEncryptionInfo(), pipe package bits through encryption engine.

Parameters

  rxInputStream | Input data (encrypted)
  rxOutputStream | Output data (decrypted)

Returns
  True if decryption finished without error. False otherwise.

## ◆ encrypt()

sequence< com::sun::star::beans::NamedValue > encrypt | ( | [in] com::sun::star::io::XInputStream | rxInputStream | ) |

Encrypt given stream.

After setting up crypto via setupEncryption(), use this method to encrypt content.

Returns
  Sequence of named output streams, specific to the crypto provider. The names of sequence entry denote the substream identifiers, if any. In the case of MS OLE storage, it's the substorage names.

## ◆ generateEncryptionKey()

boolean generateEncryptionKey | ( | [in] string | rPassword | ) |

Set or refresh encryption key.

Parameters

  rPassword | Optional password to use for generating encryption key.

Returns
  True if key setup was successful. False otherwise.

## ◆ readEncryptionInfo()

boolean readEncryptionInfo | ( | [in] sequence< com::sun::star::beans::NamedValue > | rStreams | ) |

Read package crypto information.

Parameters

  rStreams | Substreams of the package (in the case of MS encryption, those are OLE substorage streams).

Returns
  True if crypto info could be retrieved, and engine initialised. False otherwise.

## ◆ setupEncryption()

boolean setupEncryption | ( | [in] sequence< com::sun::star::beans::NamedValue > | rMediaEncData | ) |

Set key-value list of encryption meta data.

Use this method to setup requisite encryption meta data. Depending on the underlying crypto, this can be a salt, init vector, or other algorithm-specific information that needs to be stored alongside an encrypted document

Returns
  True if encryption algo setup finished without error. False otherwise.

The documentation for this interface was generated from the following file:

- com/sun/star/packages/XPackageEncryption.idl