+ All Categories
Home > Technology > Mule security - pgp

Mule security - pgp

Date post: 16-Apr-2017
Category:
Upload: vishnukanthro45
View: 151 times
Download: 2 times
Share this document with a friend
11
Security-PGP
Transcript
Page 1: Mule  security - pgp

Security-PGP

Page 2: Mule  security - pgp

2

PGP Security

This extension adds PGP security on endpoint communication. With PGP

you can achieve end-to-end security communication with signed and

encrypted messages between parties.

Page 3: Mule  security - pgp

3

Requirements

Policy Files

If you are running JDK 1.4+ that comes with the Sun JCE by default, you must install the Unlimited Strength Jurisdiction Policy files, which can be downloaded from the following URL (note that they are listed entirely at the bottom of the page, in the Other Downloads section):

JDK 1.4JDK 5JDK 6

These files must be installed in $JAVA_HOME$/jre/lib/security

Page 4: Mule  security - pgp

4

According to Sun, the default distribution of the JCE allows "strong, but limited strength cryptography." This means that you cannot use RSA keys bigger than 2048 bits and no symmetric ciphers that use more than 128 bits. ElGamal is not allowed at all, thus DH/DSS cannot be used for encryption.

Page 5: Mule  security - pgp

5

Encrypting and Decrypting

To encrypt and decrypt messages you need to configure the following elements:

A security manager: responsible of holding a security provider, which contains the key rings, and the encryption strategy to be used. This allows for the encryption of all messages using the same key or to facilitate the use of different key rings.

A key manager: which is responsible for reading the key rings.A credential accessor: which determines the key ring and key manager to be used to encrypt/decrypt the message being processed.

Page 6: Mule  security - pgp

6

Example

<spring:beans><spring:bean id="pgpKeyManager" class="org.mule.module.pgp.PGPKeyRingImpl"

init-method="initialise"><spring:property name="publicKeyRingFileName" value="pubring.gpg"/><spring:property name="secretKeyRingFileName" value="secring.gpg"/><spring:property name="secretAliasId" value="$

{public.KeyId.LongValue}"/> <spring:property name="secretPassphrase" value="${secret.Passphrase}"/>

</spring:bean>

<spring:bean id="credentialAccessor" class="com.somecompany.apps.AppCredentialAccessor"> <spring:property name="credentials" value="John Smith (TestingKey) &lt;[email protected]&gt;"/> </spring:bean></spring:beans>

Page 7: Mule  security - pgp

7

<pgp:security-manager><pgp:security-provider name="pgpSecurityProvider" keyManager-ref="pgpKeyManager"/>

<pgp:keybased-encryption-strategy name="keyBasedEncryptionStrategy" keyManager-ref="pgpKeyManager" credentialsAccessor-ref="credentialAccessor"/>

</pgp:security-manager>

Page 8: Mule  security - pgp

8

The pgpKeyManager (in the spring:beans tag) is the one responsible for reading the rings. You have to set all the parameters: public and secret rings, the alias id (the long value in the ring) and the secret passphrase. In the same section, you can see the credentials accessor which needs to implement the CredentialsAccessor interface basically returning the key id based on the message (MuleEvent). Finally the pgp:security-manager glues both beans.

Page 9: Mule  security - pgp

9

You are ready to encrypt and decrypt messages in your flows. The following two flows show how to use the encrypt-transformer and decrypt-transformer to encrypt and decrypt files.

Page 10: Mule  security - pgp

10

<flow name="processEncryptFiles"><file:inbound-endpoint connector-ref="inputEncrypt"

path="file:///temp/fileInput" moveToDirectory="file:///temp/fileInputBackup"moveToPattern="#[header:originalFilename].backup" transformer-

refs="file2Bytes" />

<encrypt-transformer name="pgpEncrypt"strategy-ref="keyBasedEncryptionStrategy" />

<file:outbound-endpoint connector-ref="output"path="file:///temp/fileOutput" outputPattern="#[function:datestamp]-

#[header:originalFilename]" /></flow>

<flow name="processDecryptFiles"><file:inbound-endpoint connector-ref="inputDecrypt"

path="file:///temp/fileOutput" moveToDirectory="file:///temp/fileOutputEncrypted"moveToPattern="#[header:originalFilename].backup" transformer-

refs="file2Bytes" />

<decrypt-transformer name="pgpDecrypt"strategy-ref="keyBasedEncryptionStrategy" />

<file:outbound-endpoint connector-ref="output"path="file:///temp/fileOutputDecrypted" outputPattern="#[function:datestamp]-

#[header:originalFilename]" /></flow>

Page 11: Mule  security - pgp

Recommended