Class SymmetricCrypto

    • Field Detail

      • key

        public PortParameter key
        The key to be used by this actor to encrypt/decrypt the data.
      • operationMode

        public StringParameter operationMode
        The operation mode of the cipher, either encrypt or decrypt.
      • algorithm

        public StringParameter algorithm
        The cryptography algorithm to be used for this actor.
      • cipherMode

        public StringParameter cipherMode
        The cipher mode to be used for the cipher.
      • padding

        public StringParameter padding
        The padding to be used for the cipher.
      • macAlgorithm

        public StringParameter macAlgorithm
        The secure hash algorithm for message authentication code (MAC) to be used for this actor.
      • input

        public TypedIOPort input
        The input data (for encrypt mode) or encrypted data (for decrypt mode).
      • output

        public TypedIOPort output
        The encrypted data (for encrypt mode) or decrypted data (for decrypt mode).
      • error

        public TypedIOPort error
        The error (e.g. integrity check error for MAC)
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        Override the base class to reinitialize the state if the operationMode, algorithm, cipherMode, or padding parameter is changed.
        Overrides:
        attributeChanged in class NamedObj
        Parameters:
        attribute - The attribute that changed.
        Throws:
        IllegalActionException - Not thrown in this base class.
      • fire

        public void fire()
                  throws IllegalActionException
        If there is a token on the input port, this method takes the data from the input and encrypts the data based on the algorithm, provider, mode and padding using the key read in from the key port. This processed data is then sent on the output port. All parameters should be the same as the corresponding decryption actor. This method calls javax.crypto.Cipher.init() with the value of the key.
        Specified by:
        fire in interface Executable
        Overrides:
        fire in class AtomicActor<TypedIOPort>
        Throws:
        IllegalActionException - If thrown by base class.