Beispiel #1
0
 /// <summary>Method convert public key String to block format and add a title.</summary>
 /// <remarks>Method convert public key String to block format and add a title.</remarks>
 /// <param name="publicKey">String converted to char array and than to block String</param>
 /// <returns>Return block String of publicKey</returns>
 public static string printPublicKeyBlock(string publicKey)
 {
     java.lang.StringBuilder sb = new java.lang.StringBuilder();
     sb.append("\nPublic Key:\n");
     sb.append(CryptobyHelper.charToBlockString(publicKey.ToCharArray()));
     sb.append(EOB);
     return(sb.ToString());
 }
Beispiel #2
0
 /// <summary>
 /// Method merge inputs and add a title to return String which can print
 /// encrypted text and title in User Interfaces.
 /// </summary>
 /// <remarks>
 /// Method merge inputs and add a title to return String which can print
 /// encrypted text and title in User Interfaces.
 /// </remarks>
 /// <param name="cryptType">Type of cryptology implementation as String</param>
 /// <param name="inputKeySize">Size of used key as integer</param>
 /// <param name="inputCharTextHex">
 /// Char array of String which will be converted to
 /// block
 /// </param>
 /// <returns>Return String of merged input parameter and text</returns>
 public static string printHexBlock(string cryptType, int inputKeySize, char[] inputCharTextHex
                                    )
 {
     java.lang.StringBuilder sb = new java.lang.StringBuilder();
     sb.append("\n").append(cryptType).append("-").append(inputKeySize).append(" encrypted Text in Hex form (Copy with '"
                                                                               + EOB + "'):\n");
     sb.append(CryptobyHelper.charToBlockString(inputCharTextHex));
     sb.append(EOB);
     return(sb.ToString());
 }
        public virtual void testCharToBlockString()
        {
            System.Console.Out.WriteLine("charToBlockString");
            byte[] cryptByte = Encoding.UTF8.GetBytes("TestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTest"
                                                      );
            char[] charTextHex = CryptobyHelper.bytesToHexStringUpper(cryptByte).ToCharArray(
                );
            string result = CryptobyHelper.charToBlockString(charTextHex);

            System.Console.Out.WriteLine(result);
        }