Comments (5)
Hi. You're going in the right direction by using that constructor of
PKCS11KeyStoreKeyingDataProvider. The class has different constructors for
different scenarios. If you check the java docs, the parameters that are being
passed null are key store and entry password providers, respectively. Some
smart card native libraries handle PIN requests on their own; that's why the
parameters can be null.
On your scenario you need to specify a KeyStorePasswordProvider. An interface
is used instead of directly supplying the password to allow scenarios where the
password is obtained on demand (from user input, for instance).
Hope this helps. I'm leaving this issue open until you come back with some
feedback. In the future please use the Q&A wiki section since this isn't really
an issue.
Original comment by luis.fgoncalv
on 26 Feb 2012 at 9:48
- Added labels: Type-Other
- Removed labels: Type-Defect
from xades4j.
Hi,
Thank you very much for prompt answer and sorry for publishing to issues.
Unfortunately I am just starting work with java, and although read some books,
have almost no practical knowledge, that's way shame on me, but probably I am
asking for trivial thing.
Before and after posting the first post I was experimenting with passing
arguments, but I was unable to initiate (or pass) the
KeyStoreKeyingDataProvider.KeyStorePasswordProvider properly.
Finally I understood, and it is the first time I managed to run the code ...
simple I just needed to implement the KeyStorePasswordProvider, just according
to your advice, so I put into my code:
public class KeyStorePasswordProvider implements
KeyStoreKeyingDataProvider.KeyStorePasswordProvider{
@Override
public char[] getPassword() {
String password="mypassword";
return password.toCharArray();
}
}
and
keyingDataProvider = new PKCS11KeyStoreKeyingDataProvider(
nativeLibrary,
providerName,
new FirstCertificateSelector(),
new KeyStorePasswordProvider(),
null,
true);
System.out.println(keyingDataProvider.getSigningCertificateChain().toString());
however
1. get the exception:
2012-02-27 01:16:13 main main
SEVERE: null
java.security.KeyStoreException: Can't initialize Sun PKCS#11 security provider.
Reason: xades4j.verification.UnexpectedJCAException: The keystore couldn't be
initialized
at XadES.XADES.getSigningCertificateChain(XADES.java:45)
at main.main(main.java:13)
2. Although I implemented the interface, I don't understand how can I pass card
password (now it is just written in the code).
Could you help me further please.
Thanks in advance
Brgs
Norbert
Original comment by [email protected]
on 27 Feb 2012 at 12:18
from xades4j.
When you get some sleep, you think better :-)
Just realized that I can add a constructor and pass the password via the
constructor.
public class KeyStorePasswordProvider implements
KeyStoreKeyingDataProvider.KeyStorePasswordProvider{
private String password;
@Override
public char[] getPassword() {
return password.toCharArray();
}
public KeyStorePasswordProvider(String password) {
this.password=password;
}
}
Now, I successfully accessed my smartcard.
More questions will send through Q&A.
Thank you very much for your help.
Brgs
Norbert
Original comment by [email protected]
on 27 Feb 2012 at 8:55
from xades4j.
Yes, that would be it. You're welcome!
Original comment by luis.fgoncalv
on 27 Feb 2012 at 9:30
- Changed state: Invalid
from xades4j.
hi
you can to share for me this source code? thanks alot
Original comment by [email protected]
on 30 Jul 2012 at 3:33
from xades4j.
Related Issues (20)
- FileSystemKeyStoreKeyingDataProvider pass certificate as String/Bytes HOT 5
- How to use XpathTransform HOT 10
- Add Compatibility to Java17 HOT 13
- Error generating signature with .pfx certificate DIAN Colombia HOT 11
- Problems with signature validation HOT 2
- On verify TBES signature the excepion "invalid token signature" is thrown HOT 1
- Problem validating sign in https://ec.europa.eu/cefdigital/DSS/webapp-demo/validation HOT 5
- NoClassDefFoundError with XadesSigningProfile HOT 2
- Have you installed xades4j's dependencies? The missing class is from Guice, a library used by xades4j. Is Guice available in the classpath of your application? The same applies to Apache XML Security and Bouncy Castle.
- Edit and add attributes in nodes of xadesBES according to especific format HOT 8
- Key store has more than one private key entry HOT 1
- Bump xmlsec to at least 2.3.0 HOT 3
- JAXBException with newSigner method HOT 11
- signature invalid HOT 2
- BindingSourceRestriction uses some methods missing in Java implementation for Android HOT 4
- SignatureAppendingStrategy issue with XPath transform HOT 2
- Invalid hash when signing HOT 27
- Invalid Signature produced by Xades4j HOT 10
- Migrating from Xades4j 1.7.0 to Xades4j 2.2.0 HOT 1
- Transform nodes in a Signature Policy HOT 6
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 xades4j.