Skip to content

ImportExport password issues with on OSX #23

@BillBaird

Description

@BillBaird

I've been trying to get this working on OSX. A few issues are easily handled, such as OSX's lack of support for "FriendlyName". However, I've been unable to get the ImportExportTests to execute properly.

The ImportExportTests.ImportExportECPrivateKeyPublicKeyPairPem test fails on these lines:

            var roundTripFullCert =
                importExport.CreateCertificateWithPrivateKey(
                    roundTripPublicKeyPem, 
                    roundTripRsaPrivateKeyPem, "1234");

with the error

Interop+AppleCrypto+AppleCommonCryptoCryptographicException : MAC verification failed during PKCS12 import (wrong password?)
   at Interop.AppleCrypto.X509ImportCertificate(Byte[] bytes, X509ContentType contentType, SafePasswordHandle importPassword, SafeKeychainHandle keychain, Boolean exportable, SafeSecIdentityHandle& identityHandle)
   at Internal.Cryptography.Pal.AppleCertificatePal.FromBlob(Byte[] rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
   at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] rawData, String password, X509KeyStorageFlags keyStorageFlags)
   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData, String password)
   at CertificateManager.PemDecoder.CreateCertificateWithPrivateKey(X509Certificate2 certificate, AsymmetricAlgorithm privateKey, String password) in /Users/bill/ws/SB/Certificates/AspNetCoreCertificates/src/CertificateManager/PemDecoder.cs:line 152
   at CertificateManager.ImportExportCertificate.CreateCertificateWithPrivateKey(X509Certificate2 certificate, AsymmetricAlgorithm privateKey, String password) in /Users/bill/ws/SB/Certificates/AspNetCoreCertificates/src/CertificateManager/ImportExportCertificate.cs:line 193
   at CertificateManagerTests.ImportExportTests.ImportExportECPrivateKeyPublicKeyPairPem() in /Users/bill/ws/SB/Certificates/AspNetCoreCertificates/src/CertificateManagerTests/ImportExportTests.cs

Similar issues occur on the tests ImportExportRsaPrivateKeyPublicKeyPairPem and ImportExportSingleChainedECPrivateKeyPublicKeyPairPem, always on the call importExport.CreateCertificateWithPrivateKey.

Any chance of getting this library to work on OSX? This is the only real issue that I've run into with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions