[gull] Problème avec SuisseID

sneaky56 at gmx.net sneaky56 at gmx.net
Wed Aug 15 17:26:54 CEST 2018


Bonjour,

J'essaie d'adapter une installation Fedora 28 avec son root disque crypté (cryptsetup/LUKS) de manière à pouvoir également la décrypter avec une smartcard SuisseID. J'ai bien trouvé les pistes suivantes:

  https://randomoracle.wordpress.com/2015/12/21/getting-by-without-passwords-disk-encryption-part-iii/
  https://blog.g3rt.nl/luks-smartcard-or-token.html

Mais très vite, je rencontre des problèmes que je pense dus à la SuisseID, car dans un premier temps je ne cherche qu'à chiffrer un secret avec la clé publique puis déchiffrer le résultat avec la clé privée. C'est cette dernière étape qui ne fonctionne pas (commande 5 ci-dessous):

(1) openssl rand -base64 -out secret 32

(2) pkcs15-tool --list-certificates
Using reader with a card: Alcor Micro AU9560 00 00
X.509 Certificate [SwissSign Platinum CA - G2]
	Object Flags   : [0x2], modifiable
	Authority      : no
	Path           : 3f00501543044301
	ID             : 50afcc078715476f38c5b465d1de95aae9df9ccc
	Encoded serial : 02 08 4EB200670C035D4F

X.509 Certificate [SwissSign SuisseID Platinum CA 2010 - G2]
	Object Flags   : [0x2], modifiable
	Authority      : yes
	Path           : 3f00501543044302
	ID             : e944868092ea4e5077c9e7920842d75fc0c22542
	Encoded serial : 02 10 00D5CB89C293009BEDBD014BDC109602

X.509 Certificate [FirstnameLastnameAuthentication]
	Object Flags   : [0x2], modifiable
	Authority      : no
	Path           : 3f00501543044303
	ID             : 27cf9867b14e95400b04fb024af4033b942dfbcd
	Encoded serial : 02 0F 2CDEFC16D0F80682A124BA02C027BB

X.509 Certificate [SwissSign Qualified Platinum CA 2010 - G2]
	Object Flags   : [0x2], modifiable
	Authority      : yes
	Path           : 3f00501543044304
	ID             : 7251e0aa9dfb7e3844ea026f40c89fce28bf1c77
	Encoded serial : 02 10 00AB32CDBC9B59942304FA6D84E40DBD

X.509 Certificate [FirstnameLastnameQualifiedSignature]
	Object Flags   : [0x2], modifiable
	Authority      : yes
	Path           : 3f00501543044305
	ID             : ce936c6fdce7a323f1c42999e7280abc17ae8e48
	Encoded serial : 02 0F 39223266752706098D39D1FED554B4

(3) pkcs15-tool --list-public-keys
Using reader with a card: Alcor Micro AU9560 00 00
Public RSA Key [SwissSign_nonRep                ]
	Object Flags   : [0x2], modifiable
	Usage          : [0x40], verify
	Access Flags   : [0x0]
	ModLength      : 2048
	Key ref        : -1 (0xFFFFFFFF)
	Native         : no
	Path           : 3f001fffc100
	ID             : ce936c6fdce7a323f1c42999e7280abc17ae8e48

Public RSA Key [SwissSign_digSig                ]
	Object Flags   : [0x2], modifiable
	Usage          : [0x51], encrypt, wrap, verify
	Access Flags   : [0x10], local
	ModLength      : 2048
	Key ref        : -1 (0xFFFFFFFF)
	Native         : no
	Path           : 3f00501550754b02
	ID             : 27cf9867b14e95400b04fb024af4033b942dfbcd

Public RSA Key [SwissSign_dataEnc               ]
	Object Flags   : [0x2], modifiable
	Usage          : [0x51], encrypt, wrap, verify
	Access Flags   : [0x10], local
	ModLength      : 2048
	Key ref        : -1 (0xFFFFFFFF)
	Native         : no
	Path           : 3f00501550754b03
	ID             : b5424ded7e4c12e6ea4189dbced76b0f35246099

(4) pkcs15-tool --list-keys
Using reader with a card: Alcor Micro AU9560 00 00
Private RSA Key [SwissSign_nonRep                ]
	Object Flags   : [0x3], private, modifiable
	Usage          : [0x204], sign, nonRepudiation
	Access Flags   : [0x1D], sensitive, alwaysSensitive, neverExtract, local
	ModLength      : 2048
	Key ref        : 2 (0x2)
	Native         : yes
	Path           : 3f001fffc100
	Auth ID        : 11
	ID             : ce936c6fdce7a323f1c42999e7280abc17ae8e48

Private RSA Key [SwissSign_digSig                ]
	Object Flags   : [0x3], private, modifiable
	Usage          : [0x26], decrypt, sign, unwrap
	Access Flags   : [0x1D], sensitive, alwaysSensitive, neverExtract, local
	ModLength      : 2048
	Key ref        : 2 (0x2)
	Native         : yes
	Path           : 3f00501550724b025502
	Auth ID        : 01
	ID             : 27cf9867b14e95400b04fb024af4033b942dfbcd

Private RSA Key [SwissSign_dataEnc               ]
	Object Flags   : [0x3], private, modifiable
	Usage          : [0x26], decrypt, sign, unwrap
	Access Flags   : [0x1D], sensitive, alwaysSensitive, neverExtract, local
	ModLength      : 2048
	Key ref        : 3 (0x3)
	Native         : yes
	Path           : 3f00501550724b035503
	Auth ID        : 01
	ID             : b5424ded7e4c12e6ea4189dbced76b0f35246099

(5) pkcs15-tool --read-certificate 27cf9867b14e95400b04fb024af4033b942dfbcd | openssl x509 -inform pem -noout -pubkey -out pubkey
[...]
PIN code correct.
0x7fae386ea740 17:11:27.983 [pkcs15-crypt] pkcs15-sec.c:212:sc_pkcs15_decipher: called
0x7fae386ea740 17:11:27.983 [pkcs15-crypt] pkcs15-sec.c:154:format_senv: Card does not support RSA with key length 2048
0x7fae386ea740 17:11:27.983 [pkcs15-crypt] pkcs15-sec.c:155:format_senv: returning with: -1408 (Not supported)
0x7fae386ea740 17:11:27.983 [pkcs15-crypt] pkcs15-sec.c:218:sc_pkcs15_decipher: Could not initialize security environment: -1408 (Not supported)
Decrypt failed: Not supported
[...]

(6) echo $?
1

Après un moment de recherche, j'ai trouvé ces deux commandes:

(7) pkcs11-tool --list-mechanisms
Using slot 0 with a present token (0x0)
Supported mechanisms:
  SHA-1, digest
  SHA256, digest
  SHA384, digest
  SHA512, digest
  MD5, digest
  RIPEMD160, digest
  GOSTR3411, digest

(8) opensc-tool --list-algorithms
Using reader with a card: Cherry Smart Card Reader USB (OKCM0031001140846037878527150909) 00 00
Algorithm: ec
Key length: 192
Flags:

Algorithm: ec
Key length: 224
Flags:

Algorithm: ec
Key length: 256
Flags:

Algorithm: ec
Key length: 0
Flags:

L'un de vous a-t-il de l'expérience dans le domaine? Comment pourrais-je crypter un secret qui ne serait déchiffrable qu'avec la clé privée si la méthode RSA ne fonctionne pas?

Si cela s'avère plus compliquer, il existe également la possibilité d'une rémunération mais cela nécessitera une offre préalable (courier privé pour en arriver là).

Merci d'avance pour votre input


Tom


PS: j'ai fait ces tests avec une SuisseID périmée (mais pas bloquée), mais les résultats sont les mêmes avec une non périmée.


More information about the gull mailing list