je cherche à utiliser l'API Qc3CalculateSignature. J'ai une clé au format .pem ("-----BEGIN PRIVATE KEY .... -----END PRIVATE KEY-----").
La documentation indique qu'il faut une clé au format BER (binaire) encodé au format PKCS #8.
J'ai donc effectué la conversion suivante :
Code : Tout sélectionner
openssl pkcs8 -inform PEM -outform DER -in key.pem -out key.der -topk8 -nocrypt
J'appel l'API avec les données suivantes :
- Input data format name -> DATA0100
- Algorithm description format name -> ALGD0400
- Key description format name -> KEYD0200
Pour le format ALGD0400 :
- Public key cipher algorithm -> 50
- PKA block format -> '1'
- Signing hash algorithm -> 3
Pour le format KEYD0200:
- Key type -> 51
- Key format -> '1'
J'obtiens désespérément le message :
Code : Tout sélectionner
Message . . . . : The key string or Diffie-Hellman parameter string is not valid.
Cause . . . . . : Either there is an error in the BER encoding or the BER encoded string describes an object not valid for this operation.