TripleDESEncryptionを使用して文字列を暗号化しようとしていますが、インターネットで見つけたこの例に従いました(リンク:http ://www.blackberry.com/developers/docs/3.6api/net/rim/device/api/crypto/doc -files / CryptoTest.html#sampleMD5Digest):
// sampleTripleDESEncryption
private static int sampleTripleDESEncryption( byte[] secretKey, byte[] plainText, byte[] cipherText ) throws CryptoTokenException, CryptoUnsupportedOperationException
{
// Create a new Triple-DES key based on the 24 bytes in the secretKey array
TripleDESKey key = new TripleDESKey( secretKey );
// Create a new instance of the Triple-DES encryptor engine, passing in the newly
// created key
TripleDESEncryptorEngine engine = new TripleDESEncryptorEngine( key );
// Encrypt one block (8 bytes) of plainText into cipherText
engine.encrypt( plainText, 0, cipherText, 0 );
// Return the block size of the engine
return engine.getBlockLength();
}
ただし、暗号化されたデータを文字列に変換したいと思います。暗号文変数が変換される変数であるかどうかはわかりません。何か助けはありますか?どのように変換しますか?