Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Tcl) Convert PFX with ECC Private Key and Cert to Encrypted PEMLoads a PFX (PKCS12) containing an ECC Certificate and it's ECC private key, and converts to encrypted PEM. Note: This example requires Chilkat v9.5.0.66 or greater.
load ./chilkat.dll # IMPORTANT: This example requires Chilkat v9.5.0.66 or greater. set pfx [new_CkPfx] set success [CkPfx_LoadPfxFile $pfx "qa_data/pfx/myEccCert.p12" "MY_ECC_PFX_PASSWORD"] if {$success != 1} then { puts [CkPfx_lastErrorText $pfx] delete_CkPfx $pfx exit } # If extendedAttrs is 1, then extended properties (Bag Attributes and Key Attributes) are included in the output. set extendedAttrs 0 # Set noKeys = 1 to omit private keys from the output. set noKeys 0 # Set noCerts = 1 to omit certificates from the output. set noCerts 0 # Set noCaCerts = 1 to omit CA certificates from the output. set noCaCerts 0 # The encrypt algorithm can be "des3", "aes128", "aes192", or "aes256" set encryptAlg "aes128" set pemPassword "secret123" set strPem [CkPfx_toPemEx $pfx $extendedAttrs $noKeys $noCerts $noCaCerts $encryptAlg $pemPassword] puts "$strPem" # Sample output: # # -----BEGIN ENCRYPTED PRIVATE KEY----- # MIGtMEkGCSqGSIb3DQEFDTA8MBsGCSqGSIb3DQEFDDAOBAiweNs9xIWNoAICCAAw # HQYJYIZIAWUDBAECBBCz0IMryNxuJEo5ChMktg9cBGCsKDEeRqGJX4g/X2c6CNtK # I8q7KClUwy9ms7ckHZAw/997WuW9QIGGnJEfHL/jSJsZViDwFAB4sunmdHSOTGMD # 3ZINNlkA+XobMaQtj1HNERtb1qskW1mf/X0sauw5aPA= # -----END ENCRYPTED PRIVATE KEY----- # -----BEGIN CERTIFICATE----- # MIICzjCCAlOgAwIBAgIETULS8zAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJVUzEW # MBQGA1UEChMNRW50cnVzdCwgSW5jLjEfMB0GA1UECxMWRm9yIFRlc3QgUHVycG9z # ZXMgT25seTElMCMGA1UEAxMcRW50cnVzdCBFQ0MgRGVtb25zdHJhdGlvbiBDQTAe # Fw0xNjAzMTgxMjM5MzFaFw0xNjA1MTcxMzA5MzFaMFgxHzAdBgNVBAsTFkZvciBU # ZXN0IFB1cnBvc2VzIE9ubHkxHTAbBgNVBAsTFFBlcnNvbmEgTm90IFZlcmlmaWVk # MRYwFAYDVQQDEw1DaGlsa2F0IEFkbWluMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE # uB62JGMJKXnp1PNsOOIYKGhrzfLev3O+UuthL6UzEqNNDTd8dEYMUQP/DTS3qk98 # gyQEFxdmZUsPF0fFokkZZ1cV6z7QD3MsPvSjrBzB0GUB3r8CLnDK/F4pF2Q995hr # o4HYMIHVMA4GA1UdDwEB/wQEAwIDiDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYB # BQUHAwQwNwYDVR0fBDAwLjAsoCqgKIYmaHR0cDovL2NybC5lbnRydXN0LmNvbS9D # UkwvZWNjZGVtby5jcmwwIAYDVR0RBBkwF4EVYWRtaW5AY2hpbGthdHNvZnQuY29t # MB8GA1UdIwQYMBaAFCQFS+Fkghr4Ccz7eHkh+nDmkzLqMB0GA1UdDgQWBBTB82fm # vrdG2iX5uS/agVW3L4DisjAJBgNVHRMEAjAAMAoGCCqGSM49BAMDA2kAMGYCMQCH # ILghMprWoYPEp9mCE+tpVE7vYwkFV3m0RDzT2BSUezL8Ky78XNk+XPqSB2biT70C # MQDCase1oaPY4AxCmjB+rEB1ir+QS8mrtF+iCSqHVv1aIxT6abQL57BZSdvwIm/T # T8o= # -----END CERTIFICATE----- # -----BEGIN CERTIFICATE----- # MIICljCCAhugAwIBAgIETUHhezAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJVUzEW # MBQGA1UEChMNRW50cnVzdCwgSW5jLjEfMB0GA1UECxMWRm9yIFRlc3QgUHVycG9z # ZXMgT25seTElMCMGA1UEAxMcRW50cnVzdCBFQ0MgRGVtb25zdHJhdGlvbiBDQTAe # Fw0xMTAxMjcyMDQ5NTRaFw0zNjAxMjcyMTE5NTRaMG0xCzAJBgNVBAYTAlVTMRYw # FAYDVQQKEw1FbnRydXN0LCBJbmMuMR8wHQYDVQQLExZGb3IgVGVzdCBQdXJwb3Nl # cyBPbmx5MSUwIwYDVQQDExxFbnRydXN0IEVDQyBEZW1vbnN0cmF0aW9uIENBMHYw # EAYHKoZIzj0CAQYFK4EEACIDYgAEhCWBpuJuzvRtQyibkcbCj7EkcwAqS2EqRQ/Q # ntroTdRM2SssEN4TruTxtwcY/7lR64L6Tfjz3+ujrfjNFss3EWVpUlbOJ+xHC3xH # PteNyAGZtHbZO3tVuhP6yX6dFqCCo4GLMIGIMCsGA1UdEAQkMCKADzIwMTEwMTI3 # MjA0OTU0WoEPMjAzNjAxMjcyMTE5NTRaMAsGA1UdDwQEAwIBBjAfBgNVHSMEGDAW # gBQkBUvhZIIa+AnM+3h5Ifpw5pMy6jAdBgNVHQ4EFgQUJAVL4WSCGvgJzPt4eSH6 # cOaTMuowDAYDVR0TBAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAyAhA70OIb6lb # fN6kOTQloHyCLmihNK+PT5wOuaMR//KSQP2c/H18YhDYnlwMxF9fAjEA0URaJOXM # F0qwdvS2rm7N5PWMLc/4BbeOZyZ94XJiG5u96iTgp6N9JI0MMmCQE87N # -----END CERTIFICATE----- delete_CkPfx $pfx |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.