EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Win32 error 2148073477 saving private key to win storage

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#29749
Posted: 06/10/2014 17:02:40
by Fran Thomas (Standard support level)
Joined: 05/22/2014
Posts: 13

Hi, I've been generating saving and loading certs. OK but when attempting to use them I discovered that their private keys hadn't be stored along with them.

In both examples I created an instance of the cert. storage provider using:
Code
var sysStore = new TElWinCertStorage() {
                   StorageType = TSBStorageType.stSystem,
                    AccessType = TSBStorageAccessType.atLocalMachine,
                    Provider = TSBStorageProviderType.ptBase,
                    TryCurrentUser = false,
                    SystemStores = new SBStringList.TElStringList() {
                        CertStoreName
                    }
                };


This one worked fine (however didn't save the private key):
Code
sysStore.Add(cert, CertStoreName, false, false, true);


So I updated it to specify that I should save the key using:
Code
sysStore.Add(cert, CertStoreName, true, false, true);


However I now recieve a pretty ambigous exception:
Code
SBCustomCertStorage.EElCertStorageError was caught
  _HResult=-2146233088
  _message=Win32 error 2148073477
  HResult=-2146233088
  IsTransient=false
  Message=Win32 error 2148073477
  Source=SecureBlackbox
  ErrorCode=0
  SupplErrorCode=0
  StackTrace:
       at SBWinCertStorage.TElWinCertStorage.SetPrivateKeyForCertificate(IntPtr Context, TElX509Certificate Cert, Boolean Exportable, Boolean Protected)
       at SBWinCertStorage.TElWinCertStorage.InternalAdd(TElX509Certificate Certificate, String StoreName, Boolean CopyPrivateKey, Boolean Exportable, Boolean Protected, Boolean BindToExistingPrivateKey, String PrivateKeyContainerName)
       at SBWinCertStorage.TElWinCertStorage.Add(TElX509Certificate Certificate, String StoreName, Boolean CopyPrivateKey, Boolean Exportable, Boolean Protected)
       at CloudThing.Ebics.EbicsCertificate.SaveToStore() in c:\devProj\bankbridge\trunk\CloudThing.Ebics\Certificates\EbicsCertificate.cs:line 157
  InnerException:
#29751
Posted: 06/10/2014 18:21:35
by Fran Thomas (Standard support level)
Joined: 05/22/2014
Posts: 13

NVM, solved - I'm a n00b;
Code
Provider = TSBStorageProviderType.ptDefault,

works

Reply

Statistics

Topic viewed 713 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!