Key Generation And Secure Coding In Communications And Private Learning