0

I have one test named test_PBE_Triple_DES, here I am using PBE_DES3_CBC_SHA1_ALGORITHM to decode the encrypted password but whenever I try to execute it I get an error saying that the password is not ascii.

I have provided the stacktrace below.

com.tibco.security.AXSecurityException: java.security.spec.InvalidKeySpecException: Password is not ASCII
    at com.tibco.security.providers.CryptoVendorImpl_j2se.rename(CryptoVendorImpl_j2se.java:205)
    at com.tibco.security.Crypto.rename(Crypto.java:59)
    at com.tibco.security.TestPassword.test_PBE_Triple_DES(TestPassword.java:105)
Caused by: java.security.spec.InvalidKeySpecException: Password is not ASCII
    at com.sun.crypto.provider.PBEKey.<init>(PBEKey.java:64)
    at com.sun.crypto.provider.PBEKeyFactory.engineGenerateSecret(PBEKeyFactory.java:219)
    at javax.crypto.SecretKeyFactory.generateSecret(SecretKeyFactory.java:330)
    at com.tibco.security.providers.CryptoVendorImpl_j2se.rename(CryptoVendorImpl_j2se.java:161)
Balwinder Singh
  • 2,272
  • 5
  • 23
  • 34
C.k.
  • 93
  • 2
  • 13
  • Take a look at https://stackoverflow.com/questions/10661644/java-encryption-setup-fails-with-invalidkeyspecexception – Balwinder Singh Jan 08 '19 at 05:35
  • Yes, But the combination of algorithm and key used in the post you suggested is different. Can you tell me why this type of error is thrown? – C.k. Jan 10 '19 at 07:28

3 Answers3

0

In case anyone runs into this, I was reading the password from a file on the system and it had a newline automatically appended at the end of it it by vim. After I turned off the feature off in vim it worked fine.

Here's how to disable new line. How to stop VIM from adding a newline at end of file?

C McCoy
  • 11
  • 3
0

I think the password must be number. Ex: 1247980375091875908431789013789013578901759. Worked for me.

Sham Fiorin
  • 403
  • 4
  • 16
-1

Yes, In my case there was new line character was appended. Just added trim method and it got resolved

Vedant
  • 1