i have a problem with the above mentioned method. i always get this
exception:
org.jets3t.service.CloudFrontServiceException:
java.security.spec.InvalidKeySpecException:
java.security.InvalidKeyException: IOException : algid parse error,
not a sequence at...
i call it like this:
String signedUrlCanned = CloudFrontService.signUrlCanned(
distributionDomain, // Domain name
s3ObjectKey.getKey(), // S3 object key
keyPairId, // Certificate identifier, an active
trusted signer for the distribution
derPrivateKey, // DER Private key data
//
ServiceUtils.parseIso8601Date("2009-11-14T22:20:00.000Z") //
DateLessThan
ServiceUtils.parseIso8601Date(dateLessThan));
where derPrivateKey is:
byte[] derPrivateKey = EncryptionUtil.convertRsaPemToDer(
new FileInputStream(privateKeyFilePath));
and privateKeyFilePath is:
String privateKeyFilePath = "e:\\keys\\pk-xxxxxxxxxxxxxxxxxxxx.pem";
can somebody tell me whats wrong with the key? its generated and
downloaded from my amazon aws account.
thx in advance
best regards
olli
I'm afraid there is something about Java on Windows systems that
prevents the RSA PEM files from being read correctly. There is a long
discussion thread that touches on this issue here:
https://jets3t.dev.java.net/servlets/ProjectForumMessageView?messageID=34101&forumID=2233
I would recommend following the instructions at the following link to
manually convert your AWS private key PEM file into the DER file
format which you can then use directly, without the need for the
convertRsaPemToDer method. You will need to obtain the open source
OpenSSL tool to do this.
http://forums.sun.com/thread.jspa?threadID=776346
Hope this helps,
James