/* TIA 102.AACD-A 3.8.6 */
        public void EraseAllKeys()
        {
            Begin();

            ZeroizeCommand commandKmmBody = new ZeroizeCommand();

            KmmBody responseKmmBody = TxRxKmm(commandKmmBody);

            if (responseKmmBody is ZeroizeResponse)
            {
                Logger.Debug("zerozied");
            }
            else if (responseKmmBody is NegativeAcknowledgment)
            {
                NegativeAcknowledgment kmm = responseKmmBody as NegativeAcknowledgment;

                throw new Exception(string.Format("recieved negative acknowledgment, status {0} (0x{1:X2})", kmm.Status.ToString(), (byte)kmm.Status));
            }
            else
            {
                throw new Exception("unexpected kmm");
            }

            End();
        }
Пример #2
0
        /* TIA 102.AACD-A 3.8.6 */
        public void EraseAllKeys()
        {
            Begin();

            ZeroizeCommand commandKmmBody = new ZeroizeCommand();

            KmmBody responseKmmBody = TxRxKmm(commandKmmBody);

            if (responseKmmBody is ZeroizeResponse)
            {
                Logger.Debug("zerozied");
            }
            else
            {
                throw new Exception("unexpected kmm");
            }

            End();
        }
Пример #3
0
        /* TIA 102.AACD-A 3.8.6 */
        public void EraseAllKeys()
        {
            Begin();

            try
            {
                ZeroizeCommand commandKmmBody = new ZeroizeCommand();

                KmmBody responseKmmBody = TxRxKmm(commandKmmBody);

                if (responseKmmBody is ZeroizeResponse)
                {
                    Logger.Debug("zerozied");
                }
                else if (responseKmmBody is NegativeAcknowledgment)
                {
                    NegativeAcknowledgment kmm = responseKmmBody as NegativeAcknowledgment;

                    string statusDescr  = OperationStatusExtensions.ToStatusString(kmm.Status);
                    string statusReason = OperationStatusExtensions.ToReasonString(kmm.Status);
                    throw new Exception(string.Format("received negative acknowledgment{0}status: {1} (0x{2:X2}){0}{3}", Environment.NewLine, statusDescr, kmm.Status, statusReason));
                }
                else
                {
                    throw new Exception("unexpected kmm");
                }
            }
            catch
            {
                End();

                throw;
            }

            End();
        }