/// <summary> /// Retrieve a DtmParameters by its enumeration name /// </summary> /// /// <param name="Name">The enumeration name</param> /// /// <returns>A populated DtmParameters parameter set</returns> /// /// <exception cref="CryptoAsymmetricException">Thrown if an invalid or unknown parameter name is used.</exception> public static DtmParameters FromName(DtmParamNames Name) { switch (Name) { // x1 case DtmParamNames.X11RNS1R2: return((DtmParameters)DTMX11RNS1R2.DeepCopy()); case DtmParamNames.X12RNR1R2: return((DtmParameters)DTMX12RNR1R2.DeepCopy()); case DtmParamNames.X13RNS1S2: return((DtmParameters)DTMX13RNS1S2.DeepCopy()); case DtmParamNames.X14RNT1T2: return((DtmParameters)DTMX14RNT1T2.DeepCopy()); // x2 case DtmParamNames.X21RNS1R2: return((DtmParameters)DTMX21RNS1R2.DeepCopy()); case DtmParamNames.X22RNR1R2: return((DtmParameters)DTMX22RNR1R2.DeepCopy()); case DtmParamNames.X23RNS1S2: return((DtmParameters)DTMX23RNS1S2.DeepCopy()); case DtmParamNames.X24RNT1T2: return((DtmParameters)DTMX24RNT1T2.DeepCopy()); // x3 case DtmParamNames.X31RNS1R1: return((DtmParameters)DTMX31RNS1R1.DeepCopy()); case DtmParamNames.X32RNR1R1: return((DtmParameters)DTMX32RNR1R1.DeepCopy()); case DtmParamNames.X33RNS1S1: return((DtmParameters)DTMX33RNS1S1.DeepCopy()); case DtmParamNames.X34RNT1T1: return((DtmParameters)DTMX34RNT1T1.DeepCopy()); // x4 case DtmParamNames.X41RNS1R1: return((DtmParameters)DTMX41RNS1R1.DeepCopy()); case DtmParamNames.X42RNR1R1: return((DtmParameters)DTMX42RNR1R1.DeepCopy()); case DtmParamNames.X43RNS1S1: return((DtmParameters)DTMX43RNS1S1.DeepCopy()); case DtmParamNames.X44RNT1T1: return((DtmParameters)DTMX44RNT1T1.DeepCopy()); default: throw new CryptoAsymmetricException("DtmParamSets:FromName", "The enumeration name is unknown!", new ArgumentException()); } }
/// <summary> /// Returns the security classification prefix /// </summary> /// /// <param name="Name">The DtmParameters enumeration name</param> /// /// <returns>The security classification prefix</returns> /// /// <exception cref="CryptoAsymmetricException">Thrown if an invalid or unknown parameter name is used.</exception> public static SecurityContexts GetContext(DtmParamNames Name) { switch (Name) { // x1 case DtmParamNames.X11RNS1R2: case DtmParamNames.X12RNR1R2: case DtmParamNames.X13RNS1S2: case DtmParamNames.X14RNT1T2: return(SecurityContexts.X1); // x2 case DtmParamNames.X21RNS1R2: case DtmParamNames.X22RNR1R2: case DtmParamNames.X23RNS1S2: case DtmParamNames.X24RNT1T2: return(SecurityContexts.X2); // x3 case DtmParamNames.X31RNS1R1: case DtmParamNames.X32RNR1R1: case DtmParamNames.X33RNS1S1: case DtmParamNames.X34RNT1T1: return(SecurityContexts.X3); // x4 case DtmParamNames.X41RNS1R1: case DtmParamNames.X42RNR1R1: case DtmParamNames.X43RNS1S1: case DtmParamNames.X44RNT1T1: return(SecurityContexts.X4); default: throw new CryptoAsymmetricException("DtmParamSets:GetContext", "The enumeration name is unknown!", new ArgumentException()); } }
/// <summary> /// Retrieve the DtmParameters OId by its enumeration name /// </summary> /// /// <param name="Name">The enumeration name</param> /// /// <returns>The 16 byte DtmParameters OId field</returns> /// /// <exception cref="CryptoAsymmetricException">Thrown if an invalid or unknown OId is specified</exception> public static byte[] GetID(DtmParamNames Name) { switch (Name) { // x1 case DtmParamNames.X11RNS1R2: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1931), new byte[] { (byte)BlockCiphers.Serpent, (byte)Digests.Skein256, (byte)BlockCiphers.Rijndael, (byte)Digests.Skein512, 1, 1, 0, 0 })); case DtmParamNames.X12RNR1R2: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1931), new byte[] { (byte)BlockCiphers.Rijndael, (byte)Digests.Skein256, (byte)BlockCiphers.Rijndael, (byte)Digests.Skein512, 1, 2, 0, 0 })); case DtmParamNames.X13RNS1S2: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1931), new byte[] { (byte)BlockCiphers.Serpent, (byte)Digests.Skein256, (byte)BlockCiphers.Serpent, (byte)Digests.Skein512, 1, 3, 0, 0 })); case DtmParamNames.X14RNT1T2: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1931), new byte[] { (byte)BlockCiphers.Twofish, (byte)Digests.Skein256, (byte)BlockCiphers.Twofish, (byte)Digests.Skein512, 1, 4, 0, 0 })); // x2 case DtmParamNames.X21RNS1R2: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FE1499EP1), new byte[] { (byte)BlockCiphers.Serpent, (byte)Digests.None, (byte)BlockCiphers.Rijndael, (byte)Digests.Skein512, 2, 1, 0, 0 })); case DtmParamNames.X22RNR1R2: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FE1499EP1), new byte[] { (byte)BlockCiphers.Rijndael, (byte)Digests.None, (byte)BlockCiphers.Rijndael, (byte)Digests.Skein512, 2, 2, 0, 0 })); case DtmParamNames.X23RNS1S2: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FE1499EP1), new byte[] { (byte)BlockCiphers.Serpent, (byte)Digests.None, (byte)BlockCiphers.Serpent, (byte)Digests.Skein512, 2, 3, 0, 0 })); case DtmParamNames.X24RNT1T2: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FE1499EP1), new byte[] { (byte)BlockCiphers.Twofish, (byte)Digests.None, (byte)BlockCiphers.Twofish, (byte)Digests.Skein512, 2, 4, 0, 0 })); // x3 case DtmParamNames.X31RNS1R1: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FE1087EP2), new byte[] { (byte)BlockCiphers.Serpent, (byte)Digests.None, (byte)BlockCiphers.Rijndael, (byte)Digests.None, 3, 1, 0, 0 })); case DtmParamNames.X32RNR1R1: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FE1087EP2), new byte[] { (byte)BlockCiphers.Rijndael, (byte)Digests.None, (byte)BlockCiphers.Rijndael, (byte)Digests.None, 3, 2, 0, 0 })); case DtmParamNames.X33RNS1S1: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FE1087EP2), new byte[] { (byte)BlockCiphers.Serpent, (byte)Digests.None, (byte)BlockCiphers.Serpent, (byte)Digests.None, 3, 3, 0, 0 })); case DtmParamNames.X34RNT1T1: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FE1087EP2), new byte[] { (byte)BlockCiphers.Twofish, (byte)Digests.None, (byte)BlockCiphers.Twofish, (byte)Digests.None, 3, 4, 0, 0 })); // x4 case DtmParamNames.X41RNS1R1: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FA2011743), new byte[] { (byte)BlockCiphers.Serpent, (byte)Digests.None, (byte)BlockCiphers.Rijndael, (byte)Digests.None, 4, 1, 0, 0 })); case DtmParamNames.X42RNR1R1: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FA2011743), new byte[] { (byte)BlockCiphers.Rijndael, (byte)Digests.None, (byte)BlockCiphers.Rijndael, (byte)Digests.None, 4, 2, 0, 0 })); case DtmParamNames.X43RNS1S1: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FA2011743), new byte[] { (byte)BlockCiphers.Serpent, (byte)Digests.None, (byte)BlockCiphers.Serpent, (byte)Digests.None, 4, 3, 0, 0 })); case DtmParamNames.X44RNT1T1: return(ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FA2011743), new byte[] { (byte)BlockCiphers.Twofish, (byte)Digests.None, (byte)BlockCiphers.Twofish, (byte)Digests.None, 4, 4, 0, 0 })); default: throw new CryptoAsymmetricException("DtmParamSets:GetID", "The Parameter Name is not recognized!", new ArgumentException()); } }
/// <summary> /// Retrieve the DtmParameters OId by its enumeration name /// </summary> /// /// <param name="Name">The enumeration name</param> /// /// <returns>The 16 byte DtmParameters OId field</returns> /// /// <exception cref="CryptoAsymmetricException">Thrown if an invalid or unknown OId is specified</exception> public static byte[] GetID(DtmParamNames Name) { switch (Name) { case DtmParamNames.X11RNS1R2: return ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1931), new byte[] { (byte)BlockCiphers.SPX, 0, (byte)BlockCiphers.RHX, (byte)Digests.Keccak512, 1, 1, 0, 0 }); case DtmParamNames.X12RNT1S2: return ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1931), new byte[] { (byte)BlockCiphers.TFX, 0, (byte)BlockCiphers.SHX, (byte)Digests.Keccak512, 1, 2, 0, 0 }); case DtmParamNames.X21MNR2T2: return ArrayUtils.Concat(MPKCParamSets.GetID(MPKCParamSets.MPKCParamNames.FM12T67S256), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1861), new byte[] { (byte)BlockCiphers.RHX, (byte)Digests.Skein512, (byte)BlockCiphers.THX, (byte)Digests.Skein512, 2, 1, 0, 0 }); case DtmParamNames.X22MNS2R2: return ArrayUtils.Concat(MPKCParamSets.GetID(MPKCParamSets.MPKCParamNames.FM12T67S256), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1861), new byte[] { (byte)BlockCiphers.SHX, (byte)Digests.Skein512, (byte)BlockCiphers.RHX, (byte)Digests.Skein512, 2, 2, 0, 0 }); case DtmParamNames.X31RNT1R2: return ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1861), new byte[] { (byte)BlockCiphers.TFX, 0, (byte)BlockCiphers.RHX, (byte)Digests.Skein512, 3, 1, 0, 0 }); case DtmParamNames.X32RNS1T2: return ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.CX1931), new byte[] { (byte)BlockCiphers.TFX, 0, (byte)BlockCiphers.RHX, (byte)Digests.Skein512, 3, 2, 0, 0 }); case DtmParamNames.X41RNT1R1: return ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FA2011743), new byte[] { (byte)BlockCiphers.TFX, 0, (byte)BlockCiphers.RDX, 0, 4, 1, 0, 0 }); case DtmParamNames.X42RNS1R1: return ArrayUtils.Concat(RLWEParamSets.GetID(RLWEParamSets.RLWEParamNames.N512Q12289), NTRUParamSets.GetID(NTRUParamSets.NTRUParamNames.FA2011743), new byte[] { (byte)BlockCiphers.SPX, 0, (byte)BlockCiphers.RDX, 0, 4, 2, 0, 0 }); default: throw new CryptoAsymmetricException("DtmParamSets:GetID", "The Parameter Name is not recognized!", new ArgumentException()); } }
/// <summary> /// Returns the security classification prefix /// </summary> /// /// <param name="Name">The DtmParameters enumeration name</param> /// /// <returns>The security classification prefix</returns> /// /// <exception cref="CryptoAsymmetricException">Thrown if an invalid or unknown parameter name is used.</exception> public static SecurityContexts GetContext(DtmParamNames Name) { switch (Name) { case DtmParamNames.X11RNS1R2: case DtmParamNames.X12RNT1S2: return SecurityContexts.X1; case DtmParamNames.X21MNR2T2: case DtmParamNames.X22MNS2R2: return SecurityContexts.X2; case DtmParamNames.X31RNT1R2: case DtmParamNames.X32RNS1T2: return SecurityContexts.X3; case DtmParamNames.X41RNT1R1: case DtmParamNames.X42RNS1R1: return SecurityContexts.X4; default: throw new CryptoAsymmetricException("DtmParamSets:GetContext", "The enumeration name is unknown!", new ArgumentException()); } }
/// <summary> /// Retrieve a DtmParameters by its enumeration name /// </summary> /// /// <param name="Name">The enumeration name</param> /// /// <returns>A populated DtmParameters parameter set</returns> /// /// <exception cref="CryptoAsymmetricException">Thrown if an invalid or unknown parameter name is used.</exception> public static DtmParameters FromName(DtmParamNames Name) { switch (Name) { case DtmParamNames.X11RNS1R2: return (DtmParameters)DTMX11RNS1R2.DeepCopy(); case DtmParamNames.X12RNT1S2: return (DtmParameters)DTMX12RNT1S2.DeepCopy(); case DtmParamNames.X21MNR2T2: return (DtmParameters)DTMX21MNR2T2.DeepCopy(); case DtmParamNames.X22MNS2R2: return (DtmParameters)DTMX22MNS2R2.DeepCopy(); case DtmParamNames.X31RNT1R2: return (DtmParameters)DTMX31RNT1R2.DeepCopy(); case DtmParamNames.X32RNS1T2: return (DtmParameters)DTMX32RNS1T2.DeepCopy(); case DtmParamNames.X41RNT1R1: return (DtmParameters)DTMX41RNT1R1.DeepCopy(); case DtmParamNames.X42RNS1R1: return (DtmParameters)DTMX42RNS1R1.DeepCopy(); default: throw new CryptoAsymmetricException("DtmParamSets:FromName", "The enumeration name is unknown!", new ArgumentException()); } }