Comments (15)
Something is wrong with your cert.
Where are you storing the cert? In what format? How did it get there? etc....
Original comment by [email protected]
on 24 May 2011 at 9:10
from javapns.
Same problem here. It worked fine on a different machine, so I'm not sure
what's wrong.
I'm storing the certificate as a file, "testcert.p12". I emailed it to myself
from the machine I made it on (Keychain app -> select developer and push cert,
export). I've re-made and re-emailed it to myself so I don't think it was a
transmission error. I'm working with Eclipse Helios on a Windows 7 machine,
with JDK 1.5.
Original comment by [email protected]
on 3 Aug 2011 at 6:05
from javapns.
I assume you are using the jdk 1.5 version.
Sounds like the SSL certificate isn't loading properly... what happens when you
enable ssl certificate logging as per:
http://code.google.com/p/javapns/wiki/Tips
Original comment by [email protected]
on 3 Aug 2011 at 2:43
from javapns.
You say you 'emailed it to myself'...
Are you sure the file didn't get binhex encoded or modified in transit?
Does the filesize match on the originating machine and target machine?
Can you find a better way to copy the file? ftp? winscp? sneakernet?
Can you verify that java can load the file at all?
Original comment by [email protected]
on 3 Aug 2011 at 5:10
from javapns.
bdares, were you able to solve the issue you reported? Was it related to your
keystore format or password? May we close this issue as fixed? Thank you!
Original comment by [email protected]
on 7 Sep 2011 at 3:47
from javapns.
Original comment by [email protected]
on 9 Sep 2011 at 7:18
- Changed title: javax.crypto.BadPaddingException: Given final block not properly padded
from javapns.
Issue suspected of being caused by invalid password for given keystore.
Closing issue as no feedback was received by original poster since issue was
reported.
Please feel free to re-open if the issue is still valid.
Original comment by [email protected]
on 14 Sep 2011 at 4:00
- Changed state: Invalid
from javapns.
if we wanna decrypt a encrypted file than this exception arise (file is
encrypted).
but if we encrypt file n thank decrypt in same code thank code execute
successfully
can some help me please
Original comment by [email protected]
on 19 Oct 2011 at 7:35
from javapns.
I do not understand what you mean. Please provide a copy of the code you are
trying to run, and the exception (with stack trace) you are getting. Thank you.
Original comment by [email protected]
on 19 Oct 2011 at 2:34
from javapns.
[deleted comment]
from javapns.
[deleted comment]
from javapns.
public static void main(String[] args) throws Exception {
InputStream in = new FileInputStream(new File("C:/user.p12"));
KeyStore ks = java.security.KeyStore.getInstance("PKCS12");
ks.load(in,"user".toCharArray());
in.close();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ks);
X509TrustManager defaultTrustManager = (X509TrustManager)tmf.getTrustManagers()[0];
SSLContext context =SSLContext.getInstance("TLS");
context.init(null, new TrustManager[]{defaultTrustManager}, null);
SSLSocketFactory sslSocketFactory = context.getSocketFactory();
URL url = new URL("https://192.168.1.1:8443/test/test");
URLConnection conn = url.openConnection();
((HttpsURLConnection) conn).setHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
@Override
public boolean verify(String arg0, SSLSession arg1) {
// TODO Auto-generated method stub
return true;
}
});
((HttpsURLConnection)conn).setSSLSocketFactory(sslSocketFactory);
conn.connect();
I configure my tomcat using server.p12 , I get the following error
Exception in thread "main" java.io.IOException: failed to decrypt safe contents
entry: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(Unknown Source)
at java.security.KeyStore.load(Unknown Source)
at testpack.Newtest.main(Newtest.java:24)
Caused by: javax.crypto.BadPaddingException: Given final block not properly
padded
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.PKCS12PBECipherCore.b(DashoA13*..)
at com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC2_40.engineDoFinal(DashoA13*..)
at javax.crypto.Cipher.doFinal(DashoA13*..)
... 3 more
Original comment by [email protected]
on 23 Nov 2011 at 11:46
from javapns.
Your code is not even using the JavaPNS library... Are you requesting support
in a project you are not using? Or am I missing something here...
Original comment by [email protected]
on 23 Nov 2011 at 2:01
from javapns.
go to function extractPrivateKey()
and change alias and password
Original comment by [email protected]
on 4 Oct 2013 at 10:43
from javapns.
I want to encrypt with certificate private key (.pfx) and decrypt with public
key.
Original comment by [email protected]
on 3 Sep 2014 at 7:42
from javapns.
Related Issues (20)
- thread terminated after reached max msg send HOT 3
- Exception reporting not working for multiple payloads
- Responses not read? HOT 1
- Javapns Communication exception:Connection refused to ConnectionToAppleServer
- support for title-loc-key (ios 8.2)
- Unable to connect APNS - CommunicationException - java.net.ConnectionException : Communication Timed Out HOT 2
- Duplicate notifications being sent out at high rate
- Add content-available to PushNotificationPayload
- Do you support VoIP push notifications?
- javaapns does not supports log4j 2
- Exception java.net.SocketException
- Javapns Notifications SSL Exceptions and Closed Sockets HOT 2
- thead lake
- Version of LGPL used is not documented
- 256 byte max size is outdated for iOS7 HOT 1
- Compatibility with Java 8 HOT 1
- which is latest version for JavaPNS jar?
- Remote host closed connection during handshake
- ProxyManager not have the setProxyBasicAuthorization method
- New Category tag for Actionable Notification
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javapns.