private static string CRC_Checksum(byte[] bData) { long crc = 0xb704ce; byte[] bCRC = new byte[3]; for (int i = 0; i < bData.Length; i++) { crc = (crc << 8) ^ CRCTable[((crc >> 16) ^ bData[i]) & 0xff]; } crc &= 0xffffff; bCRC[0] = (byte)((crc & 0xFF0000) >> 16); bCRC[1] = (byte)((crc & 0x00FF00) >> 8); bCRC[2] = (byte)((crc & 0x0000FF)); return(Radix64.Encode(bCRC, false)); }
/// <summary> /// Armors an OpenPGP Cleartextsignature. /// </summary> /// <param name="strMessage">The Message that has been signed. Note that it /// must not be Dash Escaped before handing it to this function.</param> /// <param name="bSignature">The OpenPGP signature of the given /// message formated in binary.</param> /// <returns>The armored OpenPGP cleartext signature.</returns> public static string WrapCleatextSignature(string strMessage, byte[] bSignature) { return(WrapCleartextSignature(strMessage, Radix64.Encode(bSignature, true))); }
/// <summary> /// Armors a binary formated OpenPGP message. /// </summary> /// <param name="bKey">The OpenPGP message in binary form.</param> /// <returns>Returns the armored OpenPGP message.</returns> public static string WrapMessage(byte[] bMessage) { return(WrapMessage(Radix64.Encode(bMessage, true))); }
/// <summary> /// Armors an OpenPGP encoded public key. /// </summary> /// <param name="bKey">The public key encoded in OpenPGP format.</param> /// <returns>Returns the armored public key.</returns> public static string WrapPublicKey(byte[] bKey) { return(WrapPublicKey(Radix64.Encode(bKey, true))); }