Je dois accéder à un webservice sécurisé en utilisant un certificat
client. J'ai à priori fait tout ce qu'il fallait pour (selon ce que j'ai
compris), mais j'ai toujours un code d'erreur 403 (authentification
nécessaire) lorsque je fait ma requête.
Il y a peut-être quelque chose que je n'ai pas compris ou fait de
travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une idée
de l'étape en cause, cela m'aiderait beaucoup.
URL u = new URL("https://<url>");
URLConnection c = u.openConnection();
InputStream i = c.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(i));
String ligne;
while ((ligne = reader.readLine()) != null) {
System.out.println(ligne.trim());
}
i.close();
resultat :
java.io.IOException: Server returned HTTP response code: 403 for URL:
https://<url>
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1149)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at x509.Elvia.main(Elvia.java:23)
J'ai essayé de séparer trustStore et keyStore, de ne mettre QUE le crt
dans le keystore ....
les informations de debug ne m'indiquent à aucun moment qu'un certificat
client est envoyé. Ce qui ne veut pas dire que ce n'est pas le cas.
Question : Si c'était une authentification de type
"BasicAuthentification", j'aurais du préciser le nom d'utilisateur et le
mot de passe.
J'aurais trouvé logique, là, de préciser le nom d'utilisateur et qu'il
trouve automatiquement la clée (un peu comme ssh v2).
Mais à priori, ce n'est pas le cas. Donc, je ne comprend pas comment il
fait pour choisir le certificat à utiliser, surtout si j'en ai plusieurs ...
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Insitu
Mike Baroukh writes:
Bonjour.
Je dois acc.ANider N` un webservice sNicurisNi en utilisant un certificat client. J'ai .AN` priori fait tout ce qu'il fallait pour (selon ce que j'ai compris), mais j'ai toujours un code d'erreur 403 (authentification n.ANicessaire) lorsque je fait ma requNjte.
Il y a peut-.ANjtre quelque chose que je n'ai pas compris ou fait de travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une id.ANie de l'.ANitape en cause, cela m'aiderait beaucoup.
Which type of import is intended is indicated by the value of the -alias option.
.AN7 If the alias points to a key entry, then keytool assumes you are importing a certificate reply. keytool checks whether the public key in the certificate reply matches the public key stored with the alias, and exits if they are different.
.AN7 If the alias does not point to a key entry, then keytool assumes you are adding a trusted certificate entry. In this case, the alias should not already exist in the keystore. If the alias does already exist, then keytool outputs an error, since there is already a trusted certificate for that alias, and does not import the certificate. If the alias does not exist in the keystore, keytool creates a trusted certificate entry with the specified alias and as$B!>(B sociates it with the imported certificate.
La commande suivante me semblerait donc plus logique:
J'ai essay.ANi de sNiparer trustStore et keyStore,
C'est mieux.
de ne mettre QUE le crt dans le keystore ....
Pas possible, il faut bien avoir la cl.ANi privNie quelque part.
Merci encore d'avoir lu jusqu'au bout ...
De rien.
Bon courage.
insitu.
Mike Baroukh <mbaroukh@cardiweb.s.p.a.m.com> writes:
Bonjour.
Je dois acc.ANider N` un webservice sNicurisNi en utilisant un certificat
client. J'ai .AN` priori fait tout ce qu'il fallait pour (selon ce que
j'ai compris), mais j'ai toujours un code d'erreur 403
(authentification n.ANicessaire) lorsque je fait ma requNjte.
Il y a peut-.ANjtre quelque chose que je n'ai pas compris ou fait de
travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une id.ANie
de l'.ANitape en cause, cela m'aiderait beaucoup.
Which type of import is intended is indicated by the value of the
-alias option.
.AN7 If the alias points to a key entry,
then keytool assumes you are importing a certificate reply. keytool
checks whether the public key in the certificate reply matches the
public key stored with the alias, and exits if they are different.
.AN7 If the alias does not point to a key entry,
then keytool assumes you are adding a trusted certificate entry. In
this case, the alias should not already exist in the keystore. If the
alias does already exist, then keytool outputs an error, since there
is already a trusted certificate for that alias, and does not import
the certificate. If the alias does not exist in the keystore, keytool
creates a trusted certificate entry with the specified alias and as$B!>(B
sociates it with the imported certificate.
La commande suivante me semblerait donc plus logique:
Je dois acc.ANider N` un webservice sNicurisNi en utilisant un certificat client. J'ai .AN` priori fait tout ce qu'il fallait pour (selon ce que j'ai compris), mais j'ai toujours un code d'erreur 403 (authentification n.ANicessaire) lorsque je fait ma requNjte.
Il y a peut-.ANjtre quelque chose que je n'ai pas compris ou fait de travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une id.ANie de l'.ANitape en cause, cela m'aiderait beaucoup.
Which type of import is intended is indicated by the value of the -alias option.
.AN7 If the alias points to a key entry, then keytool assumes you are importing a certificate reply. keytool checks whether the public key in the certificate reply matches the public key stored with the alias, and exits if they are different.
.AN7 If the alias does not point to a key entry, then keytool assumes you are adding a trusted certificate entry. In this case, the alias should not already exist in the keystore. If the alias does already exist, then keytool outputs an error, since there is already a trusted certificate for that alias, and does not import the certificate. If the alias does not exist in the keystore, keytool creates a trusted certificate entry with the specified alias and as$B!>(B sociates it with the imported certificate.
La commande suivante me semblerait donc plus logique:
Effectivement, ca semble plus logique et le certificat est du coup bien rattaché à la clée. Merci beaucoup.
Au final, ca ne fonctionne pas, mais je suis sur une piste : Dans les traces, le serveur distant me renvoit une liste d'autorité de certification autorisées. Hors, celle utilisée pour signer mon certificat n'y est pas. Je suppose que c'est ce qui empèche Java de choisir ce certificat.
Il y avait donc certainement 2 problemes : 1 sur le client et 1 sur le serveur. Je pense que tu viens de m'en enlever 1 ... merci encore.
Mike
Mike Baroukh writes:
Bonjour.
Je dois accéder à un webservice sécurisé en utilisant un certificat client. J'ai à priori fait tout ce qu'il fallait pour (selon ce que j'ai compris), mais j'ai toujours un code d'erreur 403 (authentification nécessaire) lorsque je fait ma requête.
Il y a peut-être quelque chose que je n'ai pas compris ou fait de travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une idée de l'étape en cause, cela m'aiderait beaucoup.
Which type of import is intended is indicated by the value of the -alias option.
· If the alias points to a key entry, then keytool assumes you are importing a certificate reply. keytool checks whether the public key in the certificate reply matches the public key stored with the alias, and exits if they are different.
· If the alias does not point to a key entry, then keytool assumes you are adding a trusted certificate entry. In this case, the alias should not already exist in the keystore. If the alias does already exist, then keytool outputs an error, since there is already a trusted certificate for that alias, and does not import the certificate. If the alias does not exist in the keystore, keytool creates a trusted certificate entry with the specified alias and as‐ sociates it with the imported certificate.
La commande suivante me semblerait donc plus logique:
Effectivement, ca semble plus logique et le certificat est du coup bien
rattaché à la clée. Merci beaucoup.
Au final, ca ne fonctionne pas, mais je suis sur une piste :
Dans les traces, le serveur distant me renvoit une liste d'autorité de
certification autorisées. Hors, celle utilisée pour signer mon
certificat n'y est pas. Je suppose que c'est ce qui empèche Java de
choisir ce certificat.
Il y avait donc certainement 2 problemes : 1 sur le client et 1 sur le
serveur. Je pense que tu viens de m'en enlever 1 ... merci encore.
Mike
Mike Baroukh <mbaroukh@cardiweb.s.p.a.m.com> writes:
Bonjour.
Je dois accéder à un webservice sécurisé en utilisant un certificat
client. J'ai à priori fait tout ce qu'il fallait pour (selon ce que
j'ai compris), mais j'ai toujours un code d'erreur 403
(authentification nécessaire) lorsque je fait ma requête.
Il y a peut-être quelque chose que je n'ai pas compris ou fait de
travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une idée
de l'étape en cause, cela m'aiderait beaucoup.
Which type of import is intended is indicated by the value of the
-alias option.
· If the alias points to a key entry,
then keytool assumes you are importing a certificate reply. keytool
checks whether the public key in the certificate reply matches the
public key stored with the alias, and exits if they are different.
· If the alias does not point to a key entry,
then keytool assumes you are adding a trusted certificate entry. In
this case, the alias should not already exist in the keystore. If the
alias does already exist, then keytool outputs an error, since there
is already a trusted certificate for that alias, and does not import
the certificate. If the alias does not exist in the keystore, keytool
creates a trusted certificate entry with the specified alias and as‐
sociates it with the imported certificate.
La commande suivante me semblerait donc plus logique:
Effectivement, ca semble plus logique et le certificat est du coup bien rattaché à la clée. Merci beaucoup.
Au final, ca ne fonctionne pas, mais je suis sur une piste : Dans les traces, le serveur distant me renvoit une liste d'autorité de certification autorisées. Hors, celle utilisée pour signer mon certificat n'y est pas. Je suppose que c'est ce qui empèche Java de choisir ce certificat.
Il y avait donc certainement 2 problemes : 1 sur le client et 1 sur le serveur. Je pense que tu viens de m'en enlever 1 ... merci encore.
Mike
Mike Baroukh writes:
Bonjour.
Je dois accéder à un webservice sécurisé en utilisant un certificat client. J'ai à priori fait tout ce qu'il fallait pour (selon ce que j'ai compris), mais j'ai toujours un code d'erreur 403 (authentification nécessaire) lorsque je fait ma requête.
Il y a peut-être quelque chose que je n'ai pas compris ou fait de travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une idée de l'étape en cause, cela m'aiderait beaucoup.
Which type of import is intended is indicated by the value of the -alias option.
· If the alias points to a key entry, then keytool assumes you are importing a certificate reply. keytool checks whether the public key in the certificate reply matches the public key stored with the alias, and exits if they are different.
· If the alias does not point to a key entry, then keytool assumes you are adding a trusted certificate entry. In this case, the alias should not already exist in the keystore. If the alias does already exist, then keytool outputs an error, since there is already a trusted certificate for that alias, and does not import the certificate. If the alias does not exist in the keystore, keytool creates a trusted certificate entry with the specified alias and as‐ sociates it with the imported certificate.
La commande suivante me semblerait donc plus logique:
Effectivement, ca semble plus logique et le certificat est du coup bien rattaché à la clée. Merci beaucoup.
Au final, ca ne fonctionne pas, mais je suis sur une piste : Dans les traces, le serveur distant me renvoit une liste d'autorité de certification autorisées. Hors, celle utilisée pour signer mon certificat n'y est pas. Je suppose que c'est ce qui empèche Java de choisir ce certificat.
Il y avait donc certainement 2 problemes : 1 sur le client et 1 sur le serveur. Je pense que tu viens de m'en enlever 1 ... merci encore.
Mike
Mike Baroukh writes:
Bonjour.
Je dois accéder à un webservice sécurisé en utilisant un certificat client. J'ai à priori fait tout ce qu'il fallait pour (selon ce que j'ai compris), mais j'ai toujours un code d'erreur 403 (authentification nécessaire) lorsque je fait ma requête.
Il y a peut-être quelque chose que je n'ai pas compris ou fait de travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une idée de l'étape en cause, cela m'aiderait beaucoup.
Which type of import is intended is indicated by the value of the -alias option.
· If the alias points to a key entry, then keytool assumes you are importing a certificate reply. keytool checks whether the public key in the certificate reply matches the public key stored with the alias, and exits if they are different.
· If the alias does not point to a key entry, then keytool assumes you are adding a trusted certificate entry. In this case, the alias should not already exist in the keystore. If the alias does already exist, then keytool outputs an error, since there is already a trusted certificate for that alias, and does not import the certificate. If the alias does not exist in the keystore, keytool creates a trusted certificate entry with the specified alias and as‐ sociates it with the imported certificate.
La commande suivante me semblerait donc plus logique:
Effectivement, ca semble plus logique et le certificat est du coup bien
rattaché à la clée. Merci beaucoup.
Au final, ca ne fonctionne pas, mais je suis sur une piste :
Dans les traces, le serveur distant me renvoit une liste d'autorité de
certification autorisées. Hors, celle utilisée pour signer mon
certificat n'y est pas. Je suppose que c'est ce qui empèche Java de
choisir ce certificat.
Il y avait donc certainement 2 problemes : 1 sur le client et 1 sur le
serveur. Je pense que tu viens de m'en enlever 1 ... merci encore.
Mike
Mike Baroukh <mbaroukh@cardiweb.s.p.a.m.com> writes:
Bonjour.
Je dois accéder à un webservice sécurisé en utilisant un certificat
client. J'ai à priori fait tout ce qu'il fallait pour (selon ce que
j'ai compris), mais j'ai toujours un code d'erreur 403
(authentification nécessaire) lorsque je fait ma requête.
Il y a peut-être quelque chose que je n'ai pas compris ou fait de
travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une idée
de l'étape en cause, cela m'aiderait beaucoup.
Which type of import is intended is indicated by the value of the
-alias option.
· If the alias points to a key entry,
then keytool assumes you are importing a certificate reply.
keytool
checks whether the public key in the certificate reply
matches the
public key stored with the alias, and exits if they are
different.
· If the alias does not point to a key entry,
then keytool assumes you are adding a trusted certificate
entry. In
this case, the alias should not already exist in the
keystore. If the
alias does already exist, then keytool outputs an error,
since there
is already a trusted certificate for that alias, and does
not import
the certificate. If the alias does not exist in the keystore,
keytool
creates a trusted certificate entry with the specified alias
and as‐
sociates it with the imported certificate.
La commande suivante me semblerait donc plus logique:
Effectivement, ca semble plus logique et le certificat est du coup bien rattaché à la clée. Merci beaucoup.
Au final, ca ne fonctionne pas, mais je suis sur une piste : Dans les traces, le serveur distant me renvoit une liste d'autorité de certification autorisées. Hors, celle utilisée pour signer mon certificat n'y est pas. Je suppose que c'est ce qui empèche Java de choisir ce certificat.
Il y avait donc certainement 2 problemes : 1 sur le client et 1 sur le serveur. Je pense que tu viens de m'en enlever 1 ... merci encore.
Mike
Mike Baroukh writes:
Bonjour.
Je dois accéder à un webservice sécurisé en utilisant un certificat client. J'ai à priori fait tout ce qu'il fallait pour (selon ce que j'ai compris), mais j'ai toujours un code d'erreur 403 (authentification nécessaire) lorsque je fait ma requête.
Il y a peut-être quelque chose que je n'ai pas compris ou fait de travers. Voici donc tout ce que j'ai fait. Si quelqu'un avait une idée de l'étape en cause, cela m'aiderait beaucoup.
Which type of import is intended is indicated by the value of the -alias option.
· If the alias points to a key entry, then keytool assumes you are importing a certificate reply. keytool checks whether the public key in the certificate reply matches the public key stored with the alias, and exits if they are different.
· If the alias does not point to a key entry, then keytool assumes you are adding a trusted certificate entry. In this case, the alias should not already exist in the keystore. If the alias does already exist, then keytool outputs an error, since there is already a trusted certificate for that alias, and does not import the certificate. If the alias does not exist in the keystore, keytool creates a trusted certificate entry with the specified alias and as‐ sociates it with the imported certificate.
La commande suivante me semblerait donc plus logique:
Pas possible, il faut bien avoir la clé privée quelque part.
Merci encore d'avoir lu jusqu'au bout ...
De rien.
Bon courage.
insitu.
devjunior
Bonjour, J'ai un problème pour la connexion sur un webservice sécurisé, j'ai reçu de trois fichiers de mon client, deux .cer et un autre .crt Sachant que c'est pas moi qui a fait la demande de certificat chez le client, La question est la suivante, comment je peux faire pour bien renseigner l'alias (mykey), et j'importe quel fichier (à mon avis c'est le fichier .crt)
Merci d'avance.
DevJunior
Bonjour,
J'ai un problème pour la connexion sur un webservice sécurisé, j'ai reçu de trois fichiers
de mon client, deux .cer et un autre .crt
Sachant que c'est pas moi qui a fait la demande de certificat chez le client,
La question est la suivante, comment je peux faire pour bien renseigner l'alias (mykey),
et j'importe quel fichier (à mon avis c'est le fichier .crt)
Bonjour, J'ai un problème pour la connexion sur un webservice sécurisé, j'ai reçu de trois fichiers de mon client, deux .cer et un autre .crt Sachant que c'est pas moi qui a fait la demande de certificat chez le client, La question est la suivante, comment je peux faire pour bien renseigner l'alias (mykey), et j'importe quel fichier (à mon avis c'est le fichier .crt)