A new technical guide explores the extraction of RSA private keys from USB tokens and smart cards using the PKCS#11 standard. The author provides a custom script developed in .NET to test device security and demonstrate how key extractability is managed through specific attributes.

The core of the research focuses on the CKA_EXTRACTABLE and CKA_SENSITIVE attributes. When CKA_EXTRACTABLE is set to true, the private key can potentially be retrieved from the device. If CKA_SENSITIVE is false, the key is accessible in plaintext, while a true value requires key wrapping mechanisms to attempt extraction.

The author utilizes SoftHSM2 as a PKCS#11-compliant simulator to demonstrate these vulnerabilities. The process involves initializing a token via OpenSC tools and using the provided script to generate keys with intentionally weakened security settings for testing purposes.

The guide emphasizes that real-world security depends on how certificate authorities configure these attributes during key generation or export. The author warns that testing should only be performed on non-production devices to avoid the compromise or loss of actual cryptographic keys.