<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:file="http://www.mulesource.org/schema/mule/file/2.0"
       xmlns:pgp="http://www.mulesource.org/schema/mule/pgp/2.0"
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
       http://www.mulesource.org/schema/mule/file/2.0 http://www.mulesource.org/schema/mule/file/2.0/mule-file.xsd
       http://www.mulesource.org/schema/mule/pgp/2.0 http://www.mulesource.org/schema/mule/pgp/2.0/mule-pgp.xsd">

    <spring:bean id="pgpKeyManager" class="org.mule.module.pgp.PGPKeyRingImpl" init-method="initialise">
        <spring:property name="publicKeyRingFileName" value="serverPublic.gpg"/>
        <spring:property name="secretKeyRingFileName" value="serverPrivate.gpg"/>
        <spring:property name="secretAliasId" value="0x6168F39C"/>
        <spring:property name="secretPassphrase" value="TestingPassphrase"/>
    </spring:bean>
    <spring:bean id="fakeCredentialAccessor" class="org.mule.module.pgp.FakeCredentialAccessor"/>

    <file:connector name="sendConnector" outputPattern="[TARGET_FILE]"/>

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

    <model name="test">
        <service name="echo">
            <inbound>
                <inbound-endpoint address="vm://echo">
                    <pgp:security-filter strategyName="keyBasedEncryptionStrategy" signRequired="true"
                                         credentialsAccessor-ref="fakeCredentialAccessor"
                                         keyManager-ref="pgpKeyManager"/>
                </inbound-endpoint>
            </inbound>
            <component class="org.mule.module.pgp.EchoMsg"/>
            <outbound>
                <outbound-pass-through-router>
                    <outbound-endpoint address="file://output">
                        <pgp:security-filter strategyName="keyBasedEncryptionStrategy" signRequired="true"
                                             credentialsAccessor-ref="fakeCredentialAccessor"
                                             keyManager-ref="pgpKeyManager"/>
                    </outbound-endpoint>
                </outbound-pass-through-router>
            </outbound>
        </service>
    </model>

</mule>
