Location: Symbol Reference > Classes > TJwCryptKey Class > TJwCryptKey.GenerateContainerKey Constructor
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwCryptKey.GenerateContainerKey Constructor
Pascal
constructor GenerateContainerKey(CSP: TJwCryptProvider; KeyPair: TJwKeyPairType; Flags: TJwKeyFlagSet; Length: Word);
Parameters 
Description 
CSP: TJwCryptProvider 
The cryptographic service provider  
KeyPair: TJwKeyPairType 
They key pair to replace in the key container of the CSP.  
Flags: TJwKeyFlagSet 
Flags to use with the WinAPI call  
Length: Word 
The length of the key 

Randomly generates a public/private key pair and stores it in the key container of the specified CSP. The new key replaces the old key (if existing) in the container. Thus, this constructor is generally used in the following way:

   try
  //try to get the key pair
  Key := TJwCryptKey.GetUserKey(CSP, KeyType)
except
  on E: EJwsclKeyApiException do
    if E.LastError = NTE_NO_KEY then
      //No key pair existed: We create one and put in the
      //container.
      Key := TJwCryptKey.GenerateContainerKey(CSP, KeyType, [], 0)
    else
      raise;
end;
Exceptions 
Description 
will be raised if the underlying Windows call fails. 
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!