I solve in this way.
In the custom template page, that contain the loop of custom post type I add this code:
<?php
/** Template Name: Restrict Area */
get_header();
?>
<?php if ( ! post_password_required() ) { ?>
//content of the page with loop of custom post type
<?php } else{
echo get_the_password_form($post->ID);
} ?>
<?php get_footer(); ?>
In single-custom-post-type.php this code:
<?php get_header(); ?>
<?php
if ( !post_password_required(id_page_custom_template) ) : ?>
//content single
<?php else: ?>
<?php echo get_the_password_form(id_page_custom_template); ?>
<?php endif; ?>
<?php get_footer(); ?>
Where id_page_custom_template must be replaced with the id of the page with custom template.