Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

christian leclerc

Ranch Hand
+ Follow
since Apr 08, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by christian leclerc

From a security perspective, we offer similar security controls from our competitors. In the end, you can't reinvent the security rule. You encrypt in transit, encrypt in storage, utilize well known encryption protocols, etc. The difference is our API is more extensive with some good features. Try it out, we want your feedback, good or bad
4 years ago
Yeah well,I can agree with your reasoning , but we add to change the name for legal reason and we didn't have time to rethink that and has our application is let you login with a swipe we choose that name.

Thanks for the reply though ;)

4 years ago

I have been working hard on a new security API that will allow anyone
to have two factor authentication for free. It’s been a personal
project as I am tired of all these accounts getting hacked due to weak

As our API is completely free, I am not here to do some publicity but
would like your comments about how I can make it even better and more
user friendly.

It's all based on REST call and we provide a JAVA, C# and PHP Toolkit.

We also provide a Radius proxy server that you can install on any
Linux based platform as well as a wordpress plugin. They are both
very easy to integrate.

Looking forward to have your comments on our API!

4 years ago
Hello guy's. I've got a problem here that I think is something like a catch 22 ...

Well here my case.

I have an object lets call an ApplicationContext that take something in the get and initialize with the query.

After a post on a form , i need to refresh manually the view to view the change.
Is like the object is re-init before the job's is done on the database or something.

I search over the internet for that ( and yes on this forum too ) but im unable to find a solution for my problems.

What I need is the simple scenario that the object is init on every request.
If I put the init method on the <f:event type="preRenderView" listener="#{applicationsController.init()}" />;
The job's is done well but all my other

@ManagedProperty(value = "#{currentApplicationContext}")
private CurrentApplicationContext currentApplicationContext;

Well if someone have any clue on that kind of behaviours please give me some advices im kind of new in JSF and im more a backend developers.


5 years ago
Hello Srinivas,
Well ... I recommand you to use ejb3 with annotations with no descriptors.

A simple EJB looks like :

has you seam to whan some remote object, your interface should implements the remote interface from ejb ..

I recommand you to use maven2 for dependencies so that you will just have to import :

and in the client side you can do an JNDI Lookup to get the remote ejb object and it should work !


Hello Jeff,
The data that I crypt is some information that is already crypted for a user ( but with symetric key ) , I want to be shure that nobody will be able to bruteforce this data by retreive it from the database.
I crypt the data with the application certificate to mitigate that risk so if the database is accessed via someone the data wont be able to decrypt .. Its security issue.

Maybe im a little parano with this but ... well ... nobody will access my data directly hehe ;)

6 years ago
It works with this method :

Encode + Crypt + Encode

byte[] base64Encoded = base64Encode(aDecryptedValue);
byte[] cryptedData = cryptX500(base64Encoded, aProperties);
byte[] cryptedBase64Encoded = base64Encode(cryptedData);
return new String(cryptedBase64Encoded);

Decode + Decrypt + Decode.

byte[] base64Decoded = base64Decode(aCryptedValue.getBytes());
byte[] decrypted = decryptX500(base64Decoded, aProperties);
byte[] decryptedAndDecoded = base64Decode(decrypted);
return decryptedAndDecoded;

Thanks guy's for the hint, here I needed an String absolutely so ... with base64 first, crypt and base64 again .. its ok for storing and for transporting.
Not the best way to do it for performance tough but it should do the job's.

6 years ago
OK I will try to put it directly as byte.
Thanks guys !
6 years ago
Hello Jeff.
First I want to thank you for taking the time to reply at my post.

Well the context is :

I crypt something and receive a ByteArrayOuputStream.

I take this ByteArrayOuputStream, put it to String, convert that String in base64 and put it in the database. (for the transfert between web & ejb, its better if its base64 encoded ny ways)
Receive the string from the database, base64 decode it and after I want to decrypt the value.

When i want to decrypt the value, its where I've got the problems.

I will try to put the ByteArrayOuputStream to base64 and after put it to a String then maybe it will solve my problem.
6 years ago
Hello guy's,

I've got a problems of conversion that Im pretty sure it is a problems of encoding but I wonder if somebody can help me with that !
Well .. the situation is that Iv'e got an crypted data that I dont know what kind of encoding its used to create my ByteArrayOutputStream.
So I've got an ByteArrayOutputStream that I want to put as string and store it in the database, after I want to get the object back from the database, and decrypt the data for the user.
Its encoded with an X509Certificate.

When I want to decrypt my data I have a problems of padding because the bytes when converting -127,-99,-112,-113 and -115 to String they are flipped to byte 63 and the encryption algorythm is scrapped.

So ... Im able to reproduce the problem with a simple example :

result :

-127 -> 63
-99 -> 63
-112 -> 63
-113 -> 63
-115 -> 63

As I said, im pretty sure that its an encoding thing but I can't be able to found how to make the bytes equals.

If anybody can help me, it will be nice because im stock here !


6 years ago
Hello Guy's,
I have to make an demo application that does SSO between Websphere and Weblogic.

Well , I have to do 2 application that will make SSO via a SAMLV2 TOKEN.

The application that will be running on Websphere will authenticate an user in IBM Tivoli Directory Server and will create a token and after the user will communicate with
Oracle Weblogic with the token in the browser request.

Ok its a little confusing for me because Im very newbe with Websphere.

Did websphere can generate the token or if I absolutely need ibm tivoli federated identity manager to make it work ?

Can someone point me in the right direction please ?


6 years ago
Hello Group,
Im kind of new with WebLogic.
I have to make a proof of concept of a custom login module that will receive a crypted xml data to authenticate a user.

The xml data will have the application key of the caller, the username and the role.
This will authenticate the user in the application because the application that will ship the token will be trusted.

Ny ways, I have some difficulties to make this works.

I followed up this tutorial to make the provider work :

When I finish the code , and everything is compiling, I even see the provider in the admin console.
But when the server start then CRASH ! I've got this error non stop with one day of trying to make this work !

Error :

I've make the code in attachement too if someone can help me with that.

Anybody have some idea why this isn't working ?

Oh by the way the classes :

was generated with the xml

With the command :

java -DcreateStubs="true" -MDF ..\XmlCryptedDataProviderAutenticator.xml -files ../src/main/java

I add the jar file too when it will be make by this command :

java -MJF XmlCryptedDataProvider.jar -files .

Source :
Compiled jar :

If anybody have any comments or any suggestion ( other then dude make your java doc in your code .. I know its like an hello world prototype ) it will be nice because im really screwed up here.



6 years ago
Thank you Arshad Noor for your response !
Finally I opted for this

Its work with my key and because for the moment performance is not a concern, I will continue my demo with this way.
When the product will be approve, I will try the other method !


6 years ago
Hello Guy's
Im trying to encrypt something in pkcs7 with the bouncy castle api.
Well I have an X509 certificate and I have able to the public key of this certificate.
I want to encrypt something for the user that have the private key of this certificate.

For the test, im able to have the X509 public certificate and the private key of the user.

This is my test case. :

Here is an example of the public certificate :

Version: V3
Subject: CN=user2
Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5

Key: Sun RSA public key, 1024 bits
modulus: 104965928970371301381642596325632286151364435665409117333116382140937162604251594686222841801447769104519105677674112917419196133678894833484801421082713999709673203500688746820522804755779458343915142839059916649881971973054828663985071994033667903640037845847065659682640478177952406704508301059842880634919
public exponent: 3
Validity: [From: Wed Nov 30 11:07:16 EST 2011,
To: Fri Dec 30 11:07:16 EST 2011]
Issuer: CN=Chris, OU=Isac, O=CA, L=Mtl, ST=Qc, C=CA
SerialNumber: [ 0133f53a e205]

Algorithm: [SHA1withRSA]
0000: 85 76 FD 1F 00 FE E1 7E 8C D9 FA 88 C6 0D 7B A6 .v..............
0010: 77 CF 0F 57 20 B6 04 86 66 B5 FE 3C 82 22 0F 53 w..W ...f..<.".S
0020: B8 2F A1 8E 06 98 BC F7 A2 66 17 C5 97 F1 34 74 ./.......f....4t
0030: DA 9A 85 44 2E 3C D2 23 0F 69 13 72 0A ED 34 29 ...D.<.#.i.r..4)
0040: 5C E6 F1 F3 F8 E6 EF D5 B5 FE D4 17 04 5A 75 58 \............ZuX
0050: F8 1A 8D 4F 25 E7 9C 88 E8 CA 68 40 2A 36 93 15 ...O%.....h@*6..
0060: 1C FA 2F 03 51 09 F4 10 11 2D 1E 00 F5 E1 02 88 ../.Q....-......
0070: E0 C8 60 C6 42 9D 77 AE 76 09 A3 95 CB 9A 99 B0 ..`.B.w.v.......


Has you can see the public key is an RSA 1024 bits.
Well ... when im trying to run the test case .. i've got this exception :

org.bouncycastle.cms.CMSException: key inappropriate for algorithm.
at org.bouncycastle.cms.CMSEnvelopedDataGenerator.generate(Unknown Source)
at org.bouncycastle.cms.CMSEnvelopedDataGenerator.generate(Unknown Source)
at ca.s3s.demos.crypto.tests.TestCryptoManager.testBouncyCastleApiLightMethod(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.internal.runners.TestMethod.invoke(
at org.junit.internal.runners.MethodRoadie.runTestMethod(
at org.junit.internal.runners.MethodRoadie$
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(
at org.junit.internal.runners.MethodRoadie.runTest(
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(
at org.junit.internal.runners.JUnit4ClassRunner$
at org.junit.internal.runners.ClassRoadie.runUnprotected(
at org.junit.internal.runners.ClassRoadie.runProtected(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
Caused by: Illegal key size or default parameters
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at org.bouncycastle.cms.CMSEnvelopedGenerator$RecipientInf.toRecipientInfo(Unknown Source)
... 25 more

Its like my RSA public key can't fit with the AES128 algorythm.
Im a little screwed up here and I really want to make this work so if someone can explain me why I can't to this little encrypt / decrypt demo It will be very nice !


6 years ago