authenticate.c

Go to the documentation of this file.
00001 /*
00002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00003 %                                                                             %
00004 %                                                                             %
00005 %                                                                             %
00006 %    AAA  U   U TTTTT H   H EEEEE N   N TTTTT IIIII  CCCC  AAA  TTTTT EEEEE   %
00007 %   A   A U   U   T   H   H E     NN  N   T     I   C     A   A   T   E       %
00008 %   AAAAA U   U   T   HHHHH EEE   N N N   T     I   C     AAAAA   T   EEE     %
00009 %   A   A U   U   T   H   H E     N  NN   T     I   C     A   A   T   E       %
00010 %   A   A  UUU    T   H   H EEEEE N   N   T   IIIII  CCCC A   A   T   EEEEE   %
00011 %                                                                             %
00012 %                                                                             %
00013 %                   Wizard's Toolkit Authentication Methods                   %
00014 %                                                                             %
00015 %                             Software Design                                 %
00016 %                               John Cristy                                   %
00017 %                               March 2003                                    %
00018 %                                                                             %
00019 %                                                                             %
00020 %  Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization      %
00021 %  dedicated to making software imaging solutions freely available.           %
00022 %                                                                             %
00023 %  You may not use this file except in compliance with the License.  You may  %
00024 %  obtain a copy of the License at                                            %
00025 %                                                                             %
00026 %    http://www.wizards-toolkit.org/script/license.php                        %
00027 %                                                                             %
00028 %  Unless required by applicable law or agreed to in writing, software        %
00029 %  distributed under the License is distributed on an "AS IS" BASIS,          %
00030 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
00031 %  See the License for the specific language governing permissions and        %
00032 %  limitations under the License.                                             %
00033 %                                                                             %
00034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00035 %
00036 %
00037 %
00038 */
00039 
00040 /*
00041   Include declarations.
00042 */
00043 #include "wizard/studio.h"
00044 #include "wizard/authenticate.h"
00045 #include "wizard/exception.h"
00046 #include "wizard/exception-private.h"
00047 #include "wizard/memory_.h"
00048 #include "wizard/secret.h"
00049 
00050 /*
00051   Define declarations.
00052 */
00053 #define SecretKeyLength  1024
00054 
00055 /*
00056   Typedef declarations.
00057 */
00058 struct _AuthenticateInfo
00059 {
00060   AuthenticateMethod
00061     method;
00062 
00063   void
00064     *handle;
00065 
00066   time_t
00067     timestamp;
00068 
00069   size_t
00070     signature;
00071 };
00072 
00073 /*
00074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00075 %                                                                             %
00076 %                                                                             %
00077 %                                                                             %
00078 %   A c q u i r e A u t h e n t i c a t e I n f o                             %
00079 %                                                                             %
00080 %                                                                             %
00081 %                                                                             %
00082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00083 %
00084 %  AcquireAuthenticateInfo() allocates the AuthenticateInfo structure.
00085 %
00086 %  The format of the AcquireAuthenticateInfo method is:
00087 %
00088 %      AuthenticateInfo *AcquireAuthenticateInfo(
00089 %        const AuthenticateMethod method,const char *path,const HashType hash)
00090 %
00091 %  A description of each parameter follows:
00092 %
00093 %    o authenticate: The authenticate type.
00094 %
00095 %    o path: The keyring path.
00096 %
00097 %    o hash: The hash type.
00098 %
00099 */
00100 WizardExport AuthenticateInfo *AcquireAuthenticateInfo(
00101   const AuthenticateMethod method,const char *path,const HashType hash)
00102 {
00103   AuthenticateInfo
00104     *authenticate_info;
00105 
00106   authenticate_info=(AuthenticateInfo *) AcquireWizardMemory(
00107     sizeof(*authenticate_info));
00108   if (authenticate_info == (AuthenticateInfo *) NULL)
00109     ThrowWizardFatalError(AuthenticateDomain,MemoryError);
00110   (void) ResetWizardMemory(authenticate_info,0,sizeof(*authenticate_info));
00111   authenticate_info->method=method;
00112   switch (method)
00113   {
00114     case SecretAuthenticateMethod:
00115     {
00116       authenticate_info->handle=(AuthenticateInfo *) AcquireSecretInfo(path,
00117         hash,SecretKeyLength);
00118       break;
00119     }
00120     default:
00121       ThrowWizardFatalError(AuthenticateDomain,EnumerateError);
00122   }
00123   authenticate_info->timestamp=time((time_t *) NULL);
00124   authenticate_info->signature=WizardSignature;
00125   return(authenticate_info);
00126 }
00127 
00128 /*
00129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00130 %                                                                             %
00131 %                                                                             %
00132 %                                                                             %
00133 %   A u t h e n t i c a t e K e y                                             %
00134 %                                                                             %
00135 %                                                                             %
00136 %                                                                             %
00137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00138 %
00139 %  AuthenticateKey() returns WizardTrue if the caller is authenticated.
00140 %
00141 %  The format of the AuthenticateKey method is:
00142 %
00143 %      void AuthenticateKey(AuthenticateInfo *authenticate_info,
00144 %        ExceptionInfo *exception)
00145 %
00146 %  A description of each parameter follows:
00147 %
00148 %    o authenticate_info: The authenticate info.
00149 %
00150 %    o exception: Return any errors or warnings in this structure.
00151 %
00152 */
00153 WizardExport WizardBooleanType AuthenticateKey(
00154   AuthenticateInfo *authenticate_info,ExceptionInfo *exception)
00155 {
00156   WizardBooleanType
00157     status;
00158 
00159   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00160   WizardAssert(AuthenticateDomain,
00161     authenticate_info != (AuthenticateInfo *) NULL);
00162   WizardAssert(AuthenticateDomain,
00163     authenticate_info->signature == WizardSignature);
00164   WizardAssert(AuthenticateDomain,
00165     authenticate_info->handle != (AuthenticateInfo *) NULL);
00166   status=WizardFalse;
00167   switch (authenticate_info->method)
00168   {
00169     case SecretAuthenticateMethod:
00170     {
00171       SecretInfo
00172         *secret_info;
00173 
00174       secret_info=(SecretInfo *) authenticate_info->handle;
00175       status=AuthenticateSecretKey(secret_info,exception);
00176       break;
00177     }
00178     default:
00179       ThrowWizardFatalError(AuthenticateDomain,EnumerateError);
00180   }
00181   return(status);
00182 }
00183 
00184 /*
00185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00186 %                                                                             %
00187 %                                                                             %
00188 %                                                                             %
00189 %   D e s t r o y A u t h e n t i c a t e I n f o                             %
00190 %                                                                             %
00191 %                                                                             %
00192 %                                                                             %
00193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00194 %
00195 %  DestroyAuthenticateInfo() zeros memory associated with the AuthenticateInfo
00196 %  structure.
00197 %
00198 %  The format of the DestroyAuthenticateInfo method is:
00199 %
00200 %      AuthenticateInfo *DestroyAuthenticateInfo(
00201 %        AuthenticateInfo *authenticate_info)
00202 %
00203 %  A description of each parameter follows:
00204 %
00205 %    o authenticate_info: The authenticate info.
00206 %
00207 */
00208 WizardExport AuthenticateInfo *DestroyAuthenticateInfo(
00209   AuthenticateInfo *authenticate_info)
00210 {
00211   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00212   WizardAssert(AuthenticateDomain,
00213     authenticate_info != (AuthenticateInfo *) NULL);
00214   WizardAssert(AuthenticateDomain,
00215     authenticate_info->signature == WizardSignature);
00216   if (authenticate_info->handle != (AuthenticateInfo *) NULL)
00217     switch (authenticate_info->method)
00218     {
00219       case SecretAuthenticateMethod:
00220       {
00221         authenticate_info->handle=DestroySecretInfo((SecretInfo *)
00222           authenticate_info->handle);
00223         break;
00224       }
00225       default:
00226         ThrowWizardFatalError(AuthenticateDomain,EnumerateError);
00227     }
00228   authenticate_info->signature=(~WizardSignature);
00229   authenticate_info=(AuthenticateInfo *)
00230     RelinquishWizardMemory(authenticate_info);
00231   return(authenticate_info);
00232 }
00233 
00234 /*
00235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00236 %                                                                             %
00237 %                                                                             %
00238 %                                                                             %
00239 %   G e n e r a t e A u t h e n t i c a t e K e y                             %
00240 %                                                                             %
00241 %                                                                             %
00242 %                                                                             %
00243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00244 %
00245 %  GenerateAuthenticateKey() returns WizardTrue if a secret key is generated and
00246 %  successfully added to the secret key ring.
00247 %
00248 %  The format of the GenerateAuthenticateKey method is:
00249 %
00250 %      WizardBooleanType GenerateAuthenticateKey(
00251 %        AuthenticateInfo *authenticate_info,ExceptionInfo *exception)
00252 %
00253 %  A description of each parameter follows:
00254 %
00255 %    o authenticate_info: The authenticate info.
00256 %
00257 %    o exception: Return any errors or warnings in this structure.
00258 %
00259 */
00260 WizardExport WizardBooleanType GenerateAuthenticateKey(
00261   AuthenticateInfo *authenticate_info,ExceptionInfo *exception)
00262 {
00263   WizardBooleanType
00264     status;
00265 
00266   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00267   WizardAssert(AuthenticateDomain,
00268     authenticate_info != (AuthenticateInfo *) NULL);
00269   WizardAssert(AuthenticateDomain,
00270     authenticate_info->signature == WizardSignature);
00271   WizardAssert(AuthenticateDomain,
00272     authenticate_info->handle != (AuthenticateInfo *) NULL);
00273   WizardAssert(AuthenticateDomain,exception != (ExceptionInfo *) NULL);
00274   status=WizardFalse;
00275   switch (authenticate_info->method)
00276   {
00277     case SecretAuthenticateMethod:
00278     {
00279       SecretInfo
00280         *secret_info;
00281 
00282       secret_info=(SecretInfo *) authenticate_info->handle;
00283       status=GenerateSecretKey(secret_info,exception);
00284       if (status == WizardFalse)
00285         break;
00286       break;
00287     }
00288     default:
00289       ThrowWizardFatalError(AuthenticateDomain,EnumerateError);
00290   }
00291   return(status);
00292 }
00293 
00294 /*
00295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00296 %                                                                             %
00297 %                                                                             %
00298 %                                                                             %
00299 %   G e t A u t h e n t i c a t e I d                                         %
00300 %                                                                             %
00301 %                                                                             %
00302 %                                                                             %
00303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00304 %
00305 %  GetAuthenticateId() returns the authentication id.
00306 %
00307 %  The format of the GetAuthenticateId method is:
00308 %
00309 %      const StringInfo *GetAuthenticateId(
00310 %        const AuthenticateInfo *authenticate_info)
00311 %
00312 %  A description of each parameter follows:
00313 %
00314 %    o authenticate_info: The authenticate info.
00315 %
00316 */
00317 WizardExport const StringInfo *GetAuthenticateId(
00318   const AuthenticateInfo *authenticate_info)
00319 {
00320   const StringInfo
00321     *id;
00322 
00323   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00324   WizardAssert(AuthenticateDomain,
00325     authenticate_info != (AuthenticateInfo *) NULL);
00326   WizardAssert(AuthenticateDomain,
00327     authenticate_info->signature == WizardSignature);
00328   switch (authenticate_info->method)
00329   {
00330     case SecretAuthenticateMethod:
00331     {
00332       SecretInfo
00333         *secret_info;
00334 
00335       secret_info=(SecretInfo *) authenticate_info->handle;
00336       id=GetSecretId(secret_info);
00337       break;
00338     }
00339     default:
00340       ThrowWizardFatalError(AuthenticateDomain,EnumerateError);
00341   }
00342   return(id);
00343 }
00344 
00345 /*
00346 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00347 %                                                                             %
00348 %                                                                             %
00349 %                                                                             %
00350 %   G e t A u t h e n t i c a t e K e y                                       %
00351 %                                                                             %
00352 %                                                                             %
00353 %                                                                             %
00354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00355 %
00356 %  GetAuthenticateKey() returns the authenticate key.
00357 %
00358 %  The format of the GetAuthenticateKey method is:
00359 %
00360 %      const StringInfo *GetAuthenticateKey(
00361 %        const AuthenticateInfo *authenticate_info)
00362 %
00363 %  A description of each parameter follows:
00364 %
00365 %    o authenticate_info: The authenticate info.
00366 %
00367 */
00368 WizardExport const StringInfo *GetAuthenticateKey(
00369   const AuthenticateInfo *authenticate_info)
00370 {
00371   const StringInfo
00372     *key;
00373 
00374   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00375   WizardAssert(AuthenticateDomain,
00376     authenticate_info != (AuthenticateInfo *) NULL);
00377   WizardAssert(AuthenticateDomain,
00378     authenticate_info->signature == WizardSignature);
00379   switch (authenticate_info->method)
00380   {
00381     case SecretAuthenticateMethod:
00382     {
00383       SecretInfo
00384         *secret_info;
00385 
00386       secret_info=(SecretInfo *) authenticate_info->handle;
00387       key=GetSecretKey(secret_info);
00388       break;
00389     }
00390     default:
00391       ThrowWizardFatalError(AuthenticateDomain,EnumerateError);
00392   }
00393   return(key);
00394 }
00395 
00396 /*
00397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00398 %                                                                             %
00399 %                                                                             %
00400 %                                                                             %
00401 %   G e t A u t h e n t i c a t e K e y L e n g t h                           %
00402 %                                                                             %
00403 %                                                                             %
00404 %                                                                             %
00405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00406 %
00407 %  GetAuthenticateKeyLength() returns the authenticate key length.
00408 %
00409 %  The format of the GetAuthenticateKeyLength method is:
00410 %
00411 %      size_t GetAuthenticateKeyLength(
00412 %        const AuthenticateInfo *authenticate_info)
00413 %
00414 %  A description of each parameter follows:
00415 %
00416 %    o authenticate_info: The authenticate info.
00417 %
00418 */
00419 WizardExport size_t GetAuthenticateKeyLength(
00420   const AuthenticateInfo *authenticate_info)
00421 {
00422   size_t
00423     key_length;
00424 
00425   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00426   WizardAssert(AuthenticateDomain,
00427     authenticate_info != (AuthenticateInfo *) NULL);
00428   WizardAssert(AuthenticateDomain,
00429     authenticate_info->signature == WizardSignature);
00430   switch (authenticate_info->method)
00431   {
00432     case SecretAuthenticateMethod:
00433     {
00434       SecretInfo
00435         *secret_info;
00436 
00437       secret_info=(SecretInfo *) authenticate_info->handle;
00438       key_length=GetSecretKeyLength(secret_info);
00439       break;
00440     }
00441     default:
00442       ThrowWizardFatalError(AuthenticateDomain,EnumerateError);
00443   }
00444   return(key_length);
00445 }
00446 
00447 /*
00448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00449 %                                                                             %
00450 %                                                                             %
00451 %                                                                             %
00452 %   G e t A u t h e n t i c a t e P a s s p h r a s e                         %
00453 %                                                                             %
00454 %                                                                             %
00455 %                                                                             %
00456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00457 %
00458 %  GetAuthenticateId() returns the authentication passphrase.
00459 %
00460 %  The format of the GetAuthenticatePassphrase method is:
00461 %
00462 %      const char *GetAuthenticatePassphrase(
00463 %        const AuthenticateInfo *authenticate_info)
00464 %
00465 %  A description of each parameter follows:
00466 %
00467 %    o authenticate_info: The authenticate info.
00468 %
00469 */
00470 WizardExport const char *GetAuthenticatePassphrase(
00471   const AuthenticateInfo *authenticate_info)
00472 {
00473   const char
00474     *passphrase;
00475 
00476   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00477   WizardAssert(AuthenticateDomain,
00478     authenticate_info != (AuthenticateInfo *) NULL);
00479   WizardAssert(AuthenticateDomain,
00480     authenticate_info->signature == WizardSignature);
00481   switch (authenticate_info->method)
00482   {
00483     case SecretAuthenticateMethod:
00484     {
00485       SecretInfo
00486         *secret_info;
00487 
00488       secret_info=(SecretInfo *) authenticate_info->handle;
00489       passphrase=GetSecretPassphrase(secret_info);
00490       break;
00491     }
00492     default:
00493       ThrowWizardFatalError(AuthenticateDomain,EnumerateError);
00494   }
00495   return(passphrase);
00496 }
00497 
00498 /*
00499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00500 %                                                                             %
00501 %                                                                             %
00502 %                                                                             %
00503 %   S e t A u t h e n t i c a t e I d                                         %
00504 %                                                                             %
00505 %                                                                             %
00506 %                                                                             %
00507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00508 %
00509 %  SetAuthenticateId() sets the authentication id.
00510 %
00511 %  The format of the SetAuthenticateId method is:
00512 %
00513 %      void SetAuthenticateId(AuthenticateInfo *authenticate_info,
00514 %        const StringInfo *id)
00515 %
00516 %  A description of each parameter follows:
00517 %
00518 %    o authenticate_info: The authentication info.
00519 %
00520 %    o id: The id.
00521 %
00522 */
00523 WizardExport void SetAuthenticateId(AuthenticateInfo *authenticate_info,
00524   const StringInfo *id)
00525 {
00526   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00527   WizardAssert(AuthenticateDomain,
00528     authenticate_info != (AuthenticateInfo *) NULL);
00529   WizardAssert(AuthenticateDomain,
00530     authenticate_info->signature == WizardSignature);
00531   WizardAssert(AuthenticateDomain,
00532     authenticate_info->handle != (AuthenticateInfo *) NULL);
00533   switch (authenticate_info->method)
00534   {
00535     case SecretAuthenticateMethod:
00536     {
00537       SecretInfo
00538         *secret_info;
00539 
00540       secret_info=(SecretInfo *) authenticate_info->handle;
00541       SetSecretId(secret_info,id);
00542       break;
00543     }
00544     default:
00545       ThrowWizardFatalError(AuthenticateDomain,EnumerateError);
00546   }
00547 }
00548 
00549 /*
00550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00551 %                                                                             %
00552 %                                                                             %
00553 %                                                                             %
00554 %   S e t A u t h e n t i c a t e K e y L e n g t h                           %
00555 %                                                                             %
00556 %                                                                             %
00557 %                                                                             %
00558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00559 %
00560 %  SetAuthenticateKeyLength() sets the authentication method key length.
00561 %
00562 %  The format of the SetAuthenticateKeyLength method is:
00563 %
00564 %      void SetAuthenticateKeyLength(AuthenticateInfo *authenticate_info,
00565 %        const size_t key_length)
00566 %
00567 %  A description of each parameter follows:
00568 %
00569 %    o authenticate_info: The authenticate info.
00570 %
00571 %    o key_length: The key length in bits.
00572 %
00573 */
00574 WizardExport void SetAuthenticateKeyLength(AuthenticateInfo *authenticate_info,
00575   const size_t key_length)
00576 {
00577   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00578   WizardAssert(AuthenticateDomain,
00579     authenticate_info != (AuthenticateInfo *) NULL);
00580   WizardAssert(AuthenticateDomain,
00581     authenticate_info->signature == WizardSignature);
00582   WizardAssert(AuthenticateDomain,
00583     authenticate_info->handle != (AuthenticateInfo *) NULL);
00584   switch (authenticate_info->method)
00585   {
00586     case SecretAuthenticateMethod:
00587     {
00588       SecretInfo
00589         *secret_info;
00590 
00591       secret_info=(SecretInfo *) authenticate_info->handle;
00592       SetSecretKeyLength(secret_info,key_length);
00593       break;
00594     }
00595     default:
00596       break;
00597   }
00598 }
00599 
00600 /*
00601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00602 %                                                                             %
00603 %                                                                             %
00604 %                                                                             %
00605 %   S e t A u t h e n t i c a t e P a s s p h r a s e                         %
00606 %                                                                             %
00607 %                                                                             %
00608 %                                                                             %
00609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00610 %
00611 %  SetAuthenticatePassphrase() sets the authentication method key file.
00612 %
00613 %  The format of the SetAuthenticatePassphrase method is:
00614 %
00615 %      void SetAuthenticatePassphrase(AuthenticateInfo *authenticate_info,
00616 %        const char *passphrase)
00617 %
00618 %  A description of each parameter follows:
00619 %
00620 %    o authenticate_info: The authenticate info.
00621 %
00622 %    o passphrase: The passphrase.
00623 %
00624 */
00625 WizardExport void SetAuthenticatePassphrase(AuthenticateInfo *authenticate_info,
00626   const char *passphrase)
00627 {
00628   (void) LogWizardEvent(TraceEvent,GetWizardModule(),"...");
00629   WizardAssert(AuthenticateDomain,
00630     authenticate_info != (AuthenticateInfo *) NULL);
00631   WizardAssert(AuthenticateDomain,
00632     authenticate_info->signature == WizardSignature);
00633   WizardAssert(AuthenticateDomain,
00634     authenticate_info->handle != (AuthenticateInfo *) NULL);
00635   switch (authenticate_info->method)
00636   {
00637     case SecretAuthenticateMethod:
00638     {
00639       SecretInfo
00640         *secret_info;
00641 
00642       secret_info=(SecretInfo *) authenticate_info->handle;
00643       SetSecretPassphrase(secret_info,passphrase);
00644       break;
00645     }
00646     default:
00647       break;
00648   }
00649 }
Generated by  doxygen 1.6.2-20100208