Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Loading an encrypted emf resource(Need help in how to load an emf resource that was encrypted)
Loading an encrypted emf resource [message #1036619] Mon, 08 April 2013 16:05 Go to next message
Roshan S. is currently offline Roshan S.Friend
Messages: 125
Registered: July 2009
Senior Member
I'v created EMF resources and saved them to the file system. I used the options to encrypt them. The caveat is that the package name is dynamically created when saved, so I need to open the file in order to find the package name. Now, I'm trying to load the EMF as an XMIResource, but since I do not have the package I get an IOException because the package cannot be found.
I only need to access the resource so that I can get some basic attributes for indexing purposes. My question is:

1. How can I decrypt the file and read it without creating an EMF resource (ie since I used encryption options at save, can I load a file or inputstream some other way)?

or

2. Is there a way to get the XMIResource to not look for the package name when loading?

Thanks in advance for any help I can get.
Roshan
Re: Loading an encrypted emf resource [message #1036629 is a reply to message #1036619] Mon, 08 April 2013 16:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33108
Registered: July 2009
Senior Member
Roshan,

Comments below.

On 08/04/2013 6:05 PM, Roshan S. wrote:
> I'v created EMF resources and saved them to the file system. I used
> the options to encrypt them. The caveat is that the package name is
> dynamically created when saved,
What do you mean by this?
> so I need to open the file in order to find the package name.
Are you talking about package nsURIs?
> Now, I'm trying to load the EMF as an XMIResource, but since I do not
> have the package I get an IOException because the package cannot be
> found.
Where is the package? You'll always need one to read a resource?
> I only need to access the resource so that I can get some basic
> attributes for indexing purposes. My question is:
>
> 1. How can I decrypt the file and read it without creating an EMF
> resource (ie since I used encryption options at save, can I load a
> file or inputstream some other way)?
I suppose you can always decrypt it and use a SAX parser.
>
> or
>
> 2. Is there a way to get the XMIResource to not look for the package
> name when loading?
If you don't want to create a model, you can just use SAX.
> Thanks in advance for any help I can get.
> Roshan


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Loading an encrypted emf resource [message #1036724 is a reply to message #1036629] Mon, 08 April 2013 18:32 Go to previous messageGo to next message
Roshan S. is currently offline Roshan S.Friend
Messages: 125
Registered: July 2009
Senior Member
Hi Ed,
Thanks for replying.

After looking at your response I took a look at the AESCipherImpl source, and it seems pretty straight forward in decrypting an input stream. That was the main issue I was having, because I didn't know how to decrypt it using the options Map and then load it into a file.

Quote:
> I'v created EMF resources and saved them to the file system. I used
> the options to encrypt them. The caveat is that the package name is
> dynamically created when saved,
What do you mean by this? - The xmlns is different for every type, because it extends the domain model.
> so I need to open the file in order to find the package name.
Are you talking about package nsURIs? -Is xmlns the same thing? If so, then yes.
> Now, I'm trying to load the EMF as an XMIResource, but since I do not
> have the package I get an IOException because the package cannot be
> found.
Where is the package? You'll always need one to read a resource? If I know the package name then I can create it in memory and dynamically register it, but since I can't load it when it's encrypted I cannot find out the package.
> I only need to access the resource so that I can get some basic
> attributes for indexing purposes. My question is:
>
> 1. How can I decrypt the file and read it without creating an EMF
> resource (ie since I used encryption options at save, can I load a
> file or inputstream some other way)?
I suppose you can always decrypt it and use a SAX parser. -I think this is my best bet.
>
> or
>
> 2. Is there a way to get the XMIResource to not look for the package
> name when loading?
If you don't want to create a model, you can just use SAX.
Re: Loading an encrypted emf resource [message #1036734 is a reply to message #1036724] Mon, 08 April 2013 18:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33108
Registered: July 2009
Senior Member
Roshan,

Yes, looking at the implementations is always a good idea. :-)

On 08/04/2013 8:32 PM, Roshan S. wrote:
> Hi Ed, Thanks for replying.
>
> After looking at your response I took a look at the AESCipherImpl
> source, and it seems pretty straight forward in decrypting an input
> stream. That was the main issue I was having, because I didn't know
> how to decrypt it using the options Map and then load it into a file.
>
> Quote:
>> > I'v created EMF resources and saved them to the file system. I used
>> > the options to encrypt them. The caveat is that the package name is
>> > dynamically created when saved, What do you mean by this? - The
>> xmlns is different for every type, because it extends the domain model.
>> > so I need to open the file in order to find the package name.
>> Are you talking about package nsURIs? -Is xmlns the same thing? If
>> so, then yes.
>> > Now, I'm trying to load the EMF as an XMIResource, but since I do
>> not > have the package I get an IOException because the package
>> cannot be > found.
>> Where is the package? You'll always need one to read a resource? If
>> I know the package name then I can create it in memory and
>> dynamically register it, but since I can't load it when it's
>> encrypted I cannot find out the package.
>> > I only need to access the resource so that I can get some basic >
>> attributes for indexing purposes. My question is:
>> >
>> > 1. How can I decrypt the file and read it without creating an EMF >
>> resource (ie since I used encryption options at save, can I load a >
>> file or inputstream some other way)?
>> I suppose you can always decrypt it and use a SAX parser. -I think
>> this is my best bet.
>> >
>> > or
>> >
>> > 2. Is there a way to get the XMIResource to not look for the
>> package > name when loading?
>> If you don't want to create a model, you can just use SAX.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Create File Browser
Next Topic:[CDO] CDORevisionData.NIL in revision deltas - not supported?
Goto Forum:
  


Current Time: Tue Mar 19 10:49:25 GMT 2024

Powered by FUDForum. Page generated in 0.02180 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top