Hi Lasantha,

For Jaggery, working directory is your app directory which is in
<CARBON_PRODUCT_HOME>/repository/deployment/server/jaggeryapps/<YOUR_APP> .
However if you are using Java inside Jaggery, for those Java codes working
directory is carbon product directory <CARBON_PRODUCT_HOME>.

Hence variable certificatePath should be
repository/deployment/server/jaggeryapps/Parkingapp/resources/wso2defaultpub.ce

Thanks.

On Wed, Sep 30, 2015 at 4:38 PM, Lasantha Dharmakeerthi <[email protected]>
wrote:

> Hi
> Sajith
>
> Can I get public key of certificate using this way. I tried this one but
> couldn't get public key.
>
> this is the my code
>
>   function getPublicKey(certificatePath){
>
>     var inputStream = null;
>
>     try{
>
>       log.debug("Reading certificate from ");
>       inputStream = new Packages.java.io.FileInputStream(certificatePath);
>
>       var key =
> Packages.java.security.cert.CertificateFactory.getInstance("X.509").generateCertificate(inputStream).getPublicKey();
>
>       return key;
>     }catch(e){
>       log.error("Error while getting the public key. " + e);
>       throw e;
>     }finally{
>
>       if(inputStream){
>         inputStream.close();
>       }
>     }
>
>     return null;
>
>   }
>
> Thanks
> Lasantha
>
> On Wed, Sep 30, 2015 at 4:23 PM, Sajith Ariyarathna <[email protected]>
> wrote:
>
>> Hi Lasantha,
>>
>> Assuming,
>>
>> You are reading the certificate file using Jaggery.
>>
>> In your Jaggery app, certificate file is in '
>> *resources/wso2defaultpub.cer*' path
>>
>> You can read your file using Jaggery File [1] object. Refer following
>> code snippet.
>>
>> var certFile = new File("/resources/wso2defaultpub.cer");
>> var content = certFile.readAll();
>>
>> [1] http://jaggeryjs.org/documentation.jag?api=file
>>
>> Thanks.
>>
>> On Wed, Sep 30, 2015 at 3:11 PM, Lasantha Dharmakeerthi <
>> [email protected]> wrote:
>>
>>> Hi
>>> Devs
>>>
>>> I have created jaggery app and deployed it in wso2 app cloud. I have
>>> method to read a certificate file and certificate is in the jaggery app.
>>>
>>> In local Aplication Server I used file path like wise “
>>> repository/deployment/server/jaggeryapps/Parkingapp
>>> /resources/wso2defaultpub.cer”
>>>
>>> So how can I get path to my certificate file in WSO2 App Cloud? Is it
>>> same structure?
>>>
>>> Thanks
>>> Lasantha.
>>>
>>> --
>>> Dharmakeerthi Lasantha
>>> Software Engineer Trainee, WSO2
>>> Mobile 0774928852
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Sajith Ariyarathna
>> Software Engineer; WSO2, Inc.;  http://wso2.com/
>> mobile: +94 77 6602284, +94 71 3951048
>>
>
>
>
> --
> Dharmakeerthi Lasantha
> Software Engineer Trainee, WSO2
> Mobile 0774928852
>



-- 
Sajith Ariyarathna
Software Engineer; WSO2, Inc.;  http://wso2.com/
mobile: +94 77 6602284, +94 71 3951048
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to