public void beginClearText(int hashAlgorithm) throws IOException {
  String hash;
switch (hashAlgorithm) {
case HashAlgorithmTags.SHA1:
    hash="SHA1";
  break;
case HashAlgorithmTags.SHA256:
hash="SHA256";
break;
case HashAlgorithmTags.SHA384:
hash="SHA384";
break;
case HashAlgorithmTags.SHA512:
hash="SHA512";
break;
case HashAlgorithmTags.MD2:
hash="MD2";
break;
case HashAlgorithmTags.MD5:
hash="MD5";
break;
case HashAlgorithmTags.RIPEMD160:
hash="RIPEMD160";
break;
default :
throw new IOException("unknown hash algorithm tag in beginClearText: " + hashAlgorithm);
}
String armorHdr="-----BEGIN PGP SIGNED MESSAGE-----" + nl;
String hdrs="Hash: " + hash + nl+ nl;
for (int i=0; i != armorHdr.length(); i++) {
out.write(armorHdr.charAt(i));
}
for (int i=0; i != hdrs.length(); i++) {
out.write(hdrs.charAt(i));
}
clearText=true;
newLine=true;
lastb=0;
}

public void beginClearText ( int hashAlgorithm ) throws IOException { String hash ; switch ( hashAlgorithm ) { case HashAlgorithmTags . SHA1 : hash = "SHA1" ; break ; case HashAlgorithmTags . SHA256 : hash = "SHA256" ; break ; case HashAlgorithmTags . SHA384 : hash = "SHA384" ; break ; case HashAlgorithmTags . SHA512 : hash = "SHA512" ; break ; case HashAlgorithmTags . MD2 : hash = "MD2" ; break ; case HashAlgorithmTags . MD5 : hash = "MD5" ; break ; case HashAlgorithmTags . RIPEMD160 : hash = "RIPEMD160" ; break ; default : throw new IOException ( "unknown hash algorithm tag in beginClearText: " + hashAlgorithm ) ; } String armorHdr = "-----BEGIN PGP SIGNED MESSAGE-----" + nl ; String hdrs = "Hash: " + hash + nl + nl ; for ( int i = 0 ; i != armorHdr . length ( ) ; i ++ ) { out . write ( armorHdr . charAt ( i ) ) ; } for ( int i = 0 ; i != hdrs . length ( ) ; i ++ ) { out . write ( hdrs . charAt ( i ) ) ; } clearText = true ; newLine = true ; lastb = 0 ; }
start a clear text signed message .
