コード例 #1
0
ファイル: ThalesMain.cs プロジェクト: wertyBSd/HSMThalesEmu
        private void RaiseDataSentEvent(string remoteClient, Message.MessageResponse msg)
        {
            TCPEventArgs e = new TCPEventArgs();

            e.RemoteClient = remoteClient;
            e.Data         = Utility.GetBytesFromString(msg.MessageData);
            DataSent(this, e);
        }
コード例 #2
0
 protected bool ValidateFunctionRequirement(KeyTypeTable.KeyFunction func, LMKPairs.LMKPair Pair, string var, ThalesCore.Message.MessageResponse MR)
 {
     KeyTypeTable.AuthorizedStateRequirement requirement = KeyTypeTable.GetAuthorizedStateRequirement(KeyTypeTable.KeyFunction.Generate, Pair, var);
     if (requirement == KeyTypeTable.AuthorizedStateRequirement.NotAllowed)
     {
         MR.AddElement(ErrorCodes.ER_29_FUNCTION_NOT_PERMITTED);
         return(false);
     }
     else if ((requirement == KeyTypeTable.AuthorizedStateRequirement.NeedsAuthorizedState) && (Convert.ToBoolean(Resources.GetResource(Resources.AUTHORIZED_STATE)) == false))
     {
         MR.AddElement(ErrorCodes.ER_17_HSM_IS_NOT_IN_THE_AUTHORIZED_STATE);
         return(false);
     }
     else
     {
         return(true);
     }
 }
コード例 #3
0
 protected bool ValidateKeySchemeCode(string ksc, ref KeySchemeTable.KeyScheme KS, ref ThalesCore.Message.MessageResponse MR)
 {
     try
     {
         KS = KeySchemeTable.GetKeySchemeFromValue(ksc);
         return(true);
     }
     catch (ThalesCore.Exceptions.XInvalidKeyType ex)
     {
         MR.AddElement(ErrorCodes.ER_26_INVALID_KEY_SCHEME);
         return(false);
     }
 }
コード例 #4
0
 protected bool ValidateKeyTypeCode(string ktc, out LMKPairs.LMKPair Pair, ref string Var, ref ThalesCore.Message.MessageResponse MR)
 {
     Pair = LMKPairs.LMKPair.Null;
     try
     {
         KeyTypeTable.ParseKeyTypeCode(ktc, out Pair, out Var);
         return(true);
     }
     catch (ThalesCore.Exceptions.XInvalidKeyType ex)
     {
         MR.AddElement(ErrorCodes.ER_04_INVALID_KEY_TYPE_CODE);
         return(false);
     }
 }