Re: How to hide a secret value in my Java code?

2023-10-04 Thread Richard Grin
Thanks to everyone who replied with different solutions, especially to 
Neil for this detailed explanation about how to use the actions.


Le 04/10/2023 à 19:07, Neil C Smith a écrit :

On Wed, 4 Oct 2023 at 10:16, Richard Grin
 wrote:

Is it possible to add an environment variable for *only one* Java
project in NetBeans?

...

I use Maven to build the project.

Incidentally, to do this with Maven projects, use the project properties.

Under Actions, choose eg. `Run project` or `Run file via main()`.

Use the Add button under Set Properties and choose New Environment
Variable.  This will add to the text area eg. `Env.FOO=bar`.

That will be passed along to your project just when you run it via that action.

Best wishes,

Neil


-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



RE: How to hide a secret value in my Java code?

2023-10-04 Thread Nelligan, Steven M

I use keepass and the command line interface to access passwords through java.
Keepass would require a password and I also use a Key File(stored on a server), 
and by isolate this password in one class, you should be able to limit access 
to this one source.




Steven M Nelligan

From: Laszlo Kishalmi 
Sent: Wednesday, October 4, 2023 11:59 AM
To: users@netbeans.apache.org
Subject: Re: How to hide a secret value in my Java code?


Well, the zero secret problem (the secret which allows you to access further 
secrets), are usually solved by providing an environment. It could be as simple 
as an environment variable, or some confinement, entitled with policies.
On 10/4/23 08:33, Richard Grin wrote:
I answer your question: it could be, for example, a password of a user of a 
database, put in a Java variable or used in an annotation, or a secret key for 
an API.

Any way of hiding the secret value in the  source code would be appropriate., 
using Maven or nor.



Envoyé depuis mon appareil Galaxy



 Message d'origine 
De : Alonso Del Arte 
Date : 04/10/2023 16:49 (GMT+01:00)
À : Richard Grin 
, 
NetBeans Mailing List 

Objet : Re: How to hide a secret value in my Java code?

I suppose you could encrypt the value in a String field or function in one 
class and then have another class that decrypts that value. This would be a 
slightly more laborious version of hiding the key under the welcome mat, but 
not much safer.

Maybe I'm misunderstanding. Is the secret value for Maven's use?

Al

On Wed, Oct 4, 2023 at 5:16 AM Richard Grin 
mailto:richard.g...@univ-cotedazur.fr>> wrote:
Hello,

Is it possible to add an environment variable for *only one* Java
project in NetBeans? I have added a Windows user variable in the system
parameters but I find the process a bit cumbersome.

Is there a better way of hiding a secret value than using an environment
variable?

A similar problem, but perhaps more difficult to solve: how to hide a
secret value used in an *annotation* in my code (I can't use System.getenv).

I use Maven to build the project.

Kind regards,

Richard


-
To unsubscribe, e-mail: 
users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: 
users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: How to hide a secret value in my Java code?

2023-10-04 Thread Neil C Smith
On Wed, 4 Oct 2023 at 10:16, Richard Grin
 wrote:
> Is it possible to add an environment variable for *only one* Java
> project in NetBeans?
...
> I use Maven to build the project.

Incidentally, to do this with Maven projects, use the project properties.

Under Actions, choose eg. `Run project` or `Run file via main()`.

Use the Add button under Set Properties and choose New Environment
Variable.  This will add to the text area eg. `Env.FOO=bar`.

That will be passed along to your project just when you run it via that action.

Best wishes,

Neil

-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Re: How to hide a secret value in my Java code?

2023-10-04 Thread Laszlo Kishalmi
Well, the zero secret problem (the secret which allows you to access 
further secrets), are usually solved by providing an environment. It 
could be as simple as an environment variable, or some confinement, 
entitled with policies.


On 10/4/23 08:33, Richard Grin wrote:
I answer your question: it could be, for example, a password of a user 
of a database, put in a Java variable or used in an annotation, or a 
secret key for an API.


Any way of hiding the secret value in the  source code would be 
appropriate., using Maven or nor.




Envoyé depuis mon appareil Galaxy



 Message d'origine 
De : Alonso Del Arte 
Date : 04/10/2023 16:49 (GMT+01:00)
À : Richard Grin , NetBeans Mailing 
List 

Objet : Re: How to hide a secret value in my Java code?

I suppose you could encrypt the value in a String field or function in 
one class and then have another class that decrypts that value. This 
would be a slightly more laborious version of hiding the key under the 
welcome mat, but not much safer.


Maybe I'm misunderstanding. Is the secret value for Maven's use?

Al

On Wed, Oct 4, 2023 at 5:16 AM Richard Grin 
 wrote:


Hello,

Is it possible to add an environment variable for *only one* Java
project in NetBeans? I have added a Windows user variable in the
system
parameters but I find the process a bit cumbersome.

Is there a better way of hiding a secret value than using an
environment
variable?

A similar problem, but perhaps more difficult to solve: how to hide a
secret value used in an *annotation* in my code (I can't use
System.getenv).

I use Maven to build the project.

Kind regards,

Richard


-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


RE: How to hide a secret value in my Java code?

2023-10-04 Thread Richard Grin
I answer your question: it could be, for example, a password of a user of a 
database, put in a Java variable or used in an annotation, or a secret key for 
an API.

Any way of hiding the secret value in the  source code would be appropriate., 
using Maven or nor.



Envoyé depuis mon appareil Galaxy



 Message d'origine 
De : Alonso Del Arte 
Date : 04/10/2023 16:49 (GMT+01:00)
À : Richard Grin , NetBeans Mailing List 

Objet : Re: How to hide a secret value in my Java code?

I suppose you could encrypt the value in a String field or function in one 
class and then have another class that decrypts that value. This would be a 
slightly more laborious version of hiding the key under the welcome mat, but 
not much safer.

Maybe I'm misunderstanding. Is the secret value for Maven's use?

Al

On Wed, Oct 4, 2023 at 5:16 AM Richard Grin 
mailto:richard.g...@univ-cotedazur.fr>> wrote:
Hello,

Is it possible to add an environment variable for *only one* Java
project in NetBeans? I have added a Windows user variable in the system
parameters but I find the process a bit cumbersome.

Is there a better way of hiding a secret value than using an environment
variable?

A similar problem, but perhaps more difficult to solve: how to hide a
secret value used in an *annotation* in my code (I can't use System.getenv).

I use Maven to build the project.

Kind regards,

Richard


-
To unsubscribe, e-mail: 
users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: 
users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Re: How to hide a secret value in my Java code?

2023-10-04 Thread Alonso Del Arte
I suppose you could encrypt the value in a String field or function in one
class and then have another class that decrypts that value. This would be a
slightly more laborious version of hiding the key under the welcome mat,
but not much safer.

Maybe I'm misunderstanding. Is the secret value for Maven's use?

Al

On Wed, Oct 4, 2023 at 5:16 AM Richard Grin 
wrote:

> Hello,
>
> Is it possible to add an environment variable for *only one* Java
> project in NetBeans? I have added a Windows user variable in the system
> parameters but I find the process a bit cumbersome.
>
> Is there a better way of hiding a secret value than using an environment
> variable?
>
> A similar problem, but perhaps more difficult to solve: how to hide a
> secret value used in an *annotation* in my code (I can't use
> System.getenv).
>
> I use Maven to build the project.
>
> Kind regards,
>
> Richard
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
> For additional commands, e-mail: users-h...@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>


How to hide a secret value in my Java code?

2023-10-04 Thread Richard Grin

Hello,

Is it possible to add an environment variable for *only one* Java 
project in NetBeans? I have added a Windows user variable in the system 
parameters but I find the process a bit cumbersome.


Is there a better way of hiding a secret value than using an environment 
variable?


A similar problem, but perhaps more difficult to solve: how to hide a 
secret value used in an *annotation* in my code (I can't use System.getenv).


I use Maven to build the project.

Kind regards,

Richard


-
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists