# Connection Profiles Store Cipher Provider

###### Identifier:

org.eclipse.datatools.connectivity.cipherProvider

###### Since:

1.2.4 (DTP 1.9.2)

###### Description:

This cipherProvider extension point allows a client to extend the connection profile store encryption framework with a custom provider of javax.crypto.Cipher instances.

###### Configuration Markup:

<!ELEMENT extension (cipherProvider+)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED

>

<!ELEMENT cipherProvider EMPTY>

<!ATTLIST cipherProvider

fileExtension CDATA #REQUIRED

class CDATA #REQUIRED

>

Defines the file extension and its corresponding provider of javax.crypto.Cipher instances for the encryption of connection profile store files.

- fileExtension - The file extension of connection profile store files that shall be encrypted and decrypted using the cipher provider class specified in the class attribute.
  This attribute value may include an optional dot before the file extension (e.g. "profiles" or ".profiles"). The keyword "default" may be specified as the attribute value to match files with no file extension.
  The default connection profile store files that persists in the workspace use the ".dat" and ".bak" file extensions. Adopters may need to handle potential conflict with the default encryption implementation, if implementing a cipherProvider extension for files with these file extensions.
- class - The concrete class that implements the `org.eclipse.datatools.connectivity.security.ICipherProvider` interface to provide the javax.crypto.Cipher instances for the encryption and decryption of connection profile store files.
  A custom class may optionally extend the `org.eclipse.datatools.connectivity.security.CipherProviderBase` base class implementation, which reads a secret (symmetric) key specification from a bundled resource.

###### Examples:

`

         <extension
               id="org.company.connectivity.security.cipherProvider"
               point="org.eclipse.datatools.connectivity.cipherProvider">
            <cipherProvider
                  fileExtension="profile"
                  class="org.company.connectivity.security.ProfileStoreCipherProvider">
            </cipherProvider>
            <cipherProvider
                  fileExtension="default"
                  class="org.company.connectivity.security.ProfileStoreCipherProvider">
            </cipherProvider>
         </extension>

` This example registers org.company.connectivity.security.ProfileStoreCipherProvider as the provider for files with the extension ".profile" and for those with no file extension.
Sample class implementation of the org.eclipse.datatools.connectivity.security.ICipherProvider interface: `

    import org.eclipse.core.runtime.Platform;
    import org.eclipse.datatools.connectivity.security.CipherProviderBase;
    import org.eclipse.datatools.connectivity.security.ICipherProvider;
    import org.osgi.framework.Bundle;

    public class ProfileStoreCipherProvider extends CipherProviderBase
     implements ICipherProvider
    {
        /* (non-Javadoc)
         * @see org.eclipse.datatools.connectivity.security.CipherProviderBase#getKeyResource()
         */
        @Override
        protected URL getKeyResource()
        {
            Bundle bundle = Platform.getBundle( "org.company.connectivity.security" );
            return bundle != null ?
                    bundle.getResource( "cpkey" ) :  //$NON-NLS-1$
                    super.getKeyResource();
        }
    }

`

###### API Information:

[Provisional] An extension must implement the ICipherProvider interface defined in the `org.eclipse.datatools.connectivity.security` package. See the package's JavaDoc documentation for more information.

###### Supplied Implementation:

`org.eclipse.datatools.connectivity.security.CipherProviderBase` is the base class implementation of the `org.eclipse.datatools.connectivity.security.ICipherProvider` interface. It uses a default bundled encryption key as its javax.crypto.spec.SecretKeySpec.

Copyright (c) 2011 Actuate Corporation. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html .