private static byte[] GetDValue(Stream inputStream, byte[] rawPassPhrase, bool clearPassPhrase, string curveName) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown SXprUtilities.SkipOpenParenthesis(inputStream); string text = SXprUtilities.ReadString(inputStream, inputStream.ReadByte()); if (text.Equals("protected")) { SXprUtilities.ReadString(inputStream, inputStream.ReadByte()); SXprUtilities.SkipOpenParenthesis(inputStream); S2k s2k = SXprUtilities.ParseS2k(inputStream); byte[] iv = SXprUtilities.ReadBytes(inputStream, inputStream.ReadByte()); SXprUtilities.SkipCloseParenthesis(inputStream); byte[] array = SXprUtilities.ReadBytes(inputStream, inputStream.ReadByte()); KeyParameter key = PgpUtilities.DoMakeKeyFromPassPhrase(SymmetricKeyAlgorithmTag.Aes128, s2k, rawPassPhrase, clearPassPhrase); byte[] array2 = RecoverKeyData(SymmetricKeyAlgorithmTag.Aes128, "/CBC/NoPadding", key, iv, array, 0, array.Length); Stream val = (Stream) new MemoryStream(array2, false); SXprUtilities.SkipOpenParenthesis(val); SXprUtilities.SkipOpenParenthesis(val); SXprUtilities.SkipOpenParenthesis(val); SXprUtilities.ReadString(val, val.ReadByte()); return(SXprUtilities.ReadBytes(val, val.ReadByte())); } throw new PgpException("protected block not found"); }
private static byte[] GetDValue(Stream inputStream, char[] passPhrase, string curveName) { string type; SXprUtilities.SkipOpenParenthesis(inputStream); string protection; S2k s2k; byte[] iv; byte[] secKeyData; type = SXprUtilities.ReadString(inputStream, inputStream.ReadByte()); if (type.Equals("protected")) { protection = SXprUtilities.ReadString(inputStream, inputStream.ReadByte()); SXprUtilities.SkipOpenParenthesis(inputStream); s2k = SXprUtilities.ParseS2k(inputStream); iv = SXprUtilities.ReadBytes(inputStream, inputStream.ReadByte()); SXprUtilities.SkipCloseParenthesis(inputStream); secKeyData = SXprUtilities.ReadBytes(inputStream, inputStream.ReadByte()); } else { throw new PgpException("protected block not found"); } // TODO: recognise other algorithms KeyParameter key = PgpUtilities.MakeKeyFromPassPhrase(SymmetricKeyAlgorithmTag.Aes128, s2k, passPhrase); byte[] data = RecoverKeyData(SymmetricKeyAlgorithmTag.Aes128, "/CBC/NoPadding", key, iv, secKeyData, 0, secKeyData.Length); // // parse the secret key S-expr // Stream keyIn = new MemoryStream(data, false); SXprUtilities.SkipOpenParenthesis(keyIn); SXprUtilities.SkipOpenParenthesis(keyIn); SXprUtilities.SkipOpenParenthesis(keyIn); String name = SXprUtilities.ReadString(keyIn, keyIn.ReadByte()); return(SXprUtilities.ReadBytes(keyIn, keyIn.ReadByte())); }