Ejemplo n.º 1
0
        /// <summary>
        /// Retrieve the parameter OId by its enumeration name
        /// </summary>
        ///
        /// <param name="Name">The enumeration name</param>
        ///
        /// <returns>The 3 byte OId field</returns>
        ///
        /// <exception cref="MPKCException">Thrown if an invalid or unknown OId is specified</exception>
        public static byte[] GetID(MPKCParamNames Name)
        {
            switch (Name)
            {
            case MPKCParamNames.FM11T40S256:
                return(new byte[] { 1, 1, 0 });

            case MPKCParamNames.FM11T48S256:
                return(new byte[] { 1, 1, 1 });

            case MPKCParamNames.FM12T31S256:
                return(new byte[] { 1, 2, 0 });

            case MPKCParamNames.FM12T41S256:
                return(new byte[] { 1, 2, 1 });

            case MPKCParamNames.FM12T48S256:
                return(new byte[] { 1, 2, 2 });

            case MPKCParamNames.FM12T54K256:
                return(new byte[] { 1, 2, 3 });

            case MPKCParamNames.FM12T67S256:
                return(new byte[] { 1, 2, 4 });

            case MPKCParamNames.FM13T29S256:
                return(new byte[] { 1, 3, 0 });

            case MPKCParamNames.FM13T44K256:
                return(new byte[] { 1, 3, 1 });

            case MPKCParamNames.FM13T95S256:
                return(new byte[] { 1, 3, 2 });

            case MPKCParamNames.FM14T24K256:
                return(new byte[] { 1, 4, 0 });

            default:
                throw new MPKCException("MPKCParamSets:GetID", "The Parameter Name is not recognized!", new ArgumentException());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieve a parameter set by its enumeration name
        /// </summary>
        ///
        /// <param name="Name">The enumeration name</param>
        ///
        /// <returns>A populated parameter set</returns>
        ///
        /// <exception cref="MPKCException">Thrown if an invalid or unknown OId is specified</exception>
        public static MPKCParameters FromName(MPKCParamNames Name)
        {
            switch (Name)
            {
            case MPKCParamNames.FM11T40S256:
                return((MPKCParameters)MPKCFM11T40S256.Clone());

            case MPKCParamNames.FM11T48S256:
                return((MPKCParameters)MPKCFM11T48S256.Clone());

            case MPKCParamNames.FM12T31S256:
                return((MPKCParameters)MPKCFM12T31S256.Clone());

            case MPKCParamNames.FM12T41S256:
                return((MPKCParameters)MPKCFM12T41S256.Clone());

            case MPKCParamNames.FM12T48S256:
                return((MPKCParameters)MPKCFM12T48S256.Clone());

            case MPKCParamNames.FM12T54K256:
                return((MPKCParameters)MPKCFM12T54K256.Clone());

            case MPKCParamNames.FM12T67S256:
                return((MPKCParameters)MPKCFM12T67S256.Clone());

            case MPKCParamNames.FM13T29S256:
                return((MPKCParameters)MPKCFM13T29S256.Clone());

            case MPKCParamNames.FM13T44K256:
                return((MPKCParameters)MPKCFM13T44K256.Clone());

            case MPKCParamNames.FM13T95S256:
                return((MPKCParameters)MPKCFM13T95S256.Clone());

            case MPKCParamNames.FM14T24K256:
                return((MPKCParameters)MPKCFM14T24K256.Clone());

            default:
                throw new MPKCException("MPKCParamSets:FromName", "The Parameter Name is not recognized!", new ArgumentException());
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Retrieve the parameter OId by its enumeration name
        /// </summary>
        ///
        /// <param name="ParamName">The enumeration name</param>
        ///
        /// <returns>The 4 byte OId field</returns>
        ///
        /// <exception cref="CryptoAsymmetricException">Thrown if an invalid or unknown OId is specified</exception>
        public static byte[] GetID(MPKCParamNames ParamName)
        {
            switch (ParamName)
            {
            case MPKCParamNames.FM11T40S256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 11, 1 });

            case MPKCParamNames.FM11T48S256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 11, 2 });

            case MPKCParamNames.FM12T31S256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 12, 1 });

            case MPKCParamNames.FM12T41S256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 12, 2 });

            case MPKCParamNames.FM12T48S256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 12, 3 });

            case MPKCParamNames.FM12T54K256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 12, 4 });

            case MPKCParamNames.FM12T67S256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 12, 5 });

            case MPKCParamNames.FM13T29S256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 13, 1 });

            case MPKCParamNames.FM13T44K256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 13, 2 });

            case MPKCParamNames.FM13T95S256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 13, 3 });

            case MPKCParamNames.FM14T24K256:
                return(new byte[] { (byte)AsymmetricEngines.McEliece, 1, 14, 1 });

            default:
                throw new CryptoAsymmetricException("MPKCParamSets:GetID", "The Parameter Name is not recognized!", new ArgumentException());
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Retrieve the parameter OId by its enumeration name
 /// </summary>
 /// 
 /// <param name="Name">The enumeration name</param>
 /// 
 /// <returns>The 4 byte OId field</returns>
 /// 
 /// <exception cref="CryptoAsymmetricException">Thrown if an invalid or unknown OId is specified</exception>
 public static byte[] GetID(MPKCParamNames Name)
 {
     switch (Name)
     {
         case MPKCParamNames.FM11T40S256:
             return new byte[] { 1, 1, 11, 1 };
         case MPKCParamNames.FM11T48S256:
             return new byte[] { 1, 1, 11, 2 };
         case MPKCParamNames.FM12T31S256:
             return new byte[] { 1, 1, 12, 1 };
         case MPKCParamNames.FM12T41S256:
             return new byte[] { 1, 1, 12, 2 };
         case MPKCParamNames.FM12T48S256:
             return new byte[] { 1, 1, 12, 3 };
         case MPKCParamNames.FM12T54K256:
             return new byte[] { 1, 1, 12, 4 };
         case MPKCParamNames.FM12T67S256:
             return new byte[] { 1, 1, 12, 5 };
         case MPKCParamNames.FM13T29S256:
             return new byte[] { 1, 1, 13, 1 };
         case MPKCParamNames.FM13T44K256:
             return new byte[] { 1, 1, 13, 2 };
         case MPKCParamNames.FM13T95S256:
             return new byte[] { 1, 1, 13, 3 };
         case MPKCParamNames.FM14T24K256:
             return new byte[] { 1, 1, 14, 1 };
         default:
             throw new CryptoAsymmetricException("MPKCParamSets:GetID", "The Parameter Name is not recognized!", new ArgumentException());
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Retrieve a parameter set by its enumeration name
 /// </summary>
 /// 
 /// <param name="Name">The enumeration name</param>
 /// 
 /// <returns>A populated parameter set</returns>
 /// 
 /// <exception cref="CryptoAsymmetricException">Thrown if an invalid or unknown OId is specified</exception>
 public static MPKCParameters FromName(MPKCParamNames Name)
 {
     switch (Name)
     {
         case MPKCParamNames.FM11T40S256:
             return (MPKCParameters)MPKCFM11T40S256.DeepCopy();
         case MPKCParamNames.FM11T48S256:
             return (MPKCParameters)MPKCFM11T48S256.DeepCopy();
         case MPKCParamNames.FM12T31S256:
             return (MPKCParameters)MPKCFM12T31S256.DeepCopy();
         case MPKCParamNames.FM12T41S256:
             return (MPKCParameters)MPKCFM12T41S256.DeepCopy();
         case MPKCParamNames.FM12T48S256:
             return (MPKCParameters)MPKCFM12T48S256.DeepCopy();
         case MPKCParamNames.FM12T54K256:
             return (MPKCParameters)MPKCFM12T54K256.DeepCopy();
         case MPKCParamNames.FM12T67S256:
             return (MPKCParameters)MPKCFM12T67S256.DeepCopy();
         case MPKCParamNames.FM13T29S256:
             return (MPKCParameters)MPKCFM13T29S256.DeepCopy();
         case MPKCParamNames.FM13T44K256:
             return (MPKCParameters)MPKCFM13T44K256.DeepCopy();
         case MPKCParamNames.FM13T95S256:
             return (MPKCParameters)MPKCFM13T95S256.DeepCopy();
         case MPKCParamNames.FM14T24K256:
             return (MPKCParameters)MPKCFM14T24K256.DeepCopy();
         default:
             throw new CryptoAsymmetricException("MPKCParamSets:FromName", "The Parameter Name is not recognized!", new ArgumentException());
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Get a serialized MPKCParameters class from a parameter name
 /// </summary>
 ///
 /// <param name="ParamName">The McEliece Parameters set name</param>
 ///
 /// <returns>The serialized MPKCParameters set</returns>
 public static byte[] GetFormatted(MPKCParamNames ParamName)
 {
     return(FromName(ParamName).ToBytes());
 }