A communication apparatus (302; 304) comprising: first communication means configured to perform short range wireless communication by Bluetooth; second communication means (205, 206) configured to perform communication by wireless LAN that is different from the short range wireless communication; detection means for detecting, by using the first communication means, a partner apparatus for parameter exchange processing performed by using the second communication means to participate in a network, wherein the communication apparatus is one of a smartphone and a digital camera and the partner apparatus is the other one of the smartphone and the digital camera, wherein the communication apparatus is characterized by further comprising: determination means for determining whether a payload length transmittable by the first communication means is longer than a data length of a public key to be used in communication for the parameter exchange processing with the partner apparatus; exchanging means for exchanging, by using the first communication means, the public key in a case where the determination means determines that the payload length transmittable by the first communication means is longer than the data length of the public key, and for exchanging, by using the second communication means (205, 206), the public key in a case where the determination means determines that the payload length transmittable by the first communication means is not longer than the data length of the public key; and execution means for executing the parameter exchange processing using the public key by using the second communication means (205, 206). first communication means configured to perform short range wireless communication by Bluetooth; second communication means (205, 206) configured to perform communication by wireless LAN that is different from the short range wireless communication; detection means for detecting, by using the first communication means, a partner apparatus for parameter exchange processing performed by using the second communication means to participate in a network, wherein the communication apparatus is one of a smartphone and a digital camera and the partner apparatus is the other one of the smartphone and the digital camera, wherein the communication apparatus is characterized by further comprising: determination means for determining whether a payload length transmittable by the first communication means is longer than a data length of a public key to be used in communication for the parameter exchange processing with the partner apparatus; exchanging means for exchanging, by using the first communication means, the public key in a case where the determination means determines that the payload length transmittable by the first communication means is longer than the data length of the public key, and for exchanging, by using the second communication means (205, 206), the public key in a case where the determination means determines that the payload length transmittable by the first communication means is not longer than the data length of the public key; and execution means for executing the parameter exchange processing using the public key by using the second communication means (205, 206). determination means for determining whether a payload length transmittable by the first communication means is longer than a data length of a public key to be used in communication for the parameter exchange processing with the partner apparatus; exchanging means for exchanging, by using the first communication means, the public key in a case where the determination means determines that the payload length transmittable by the first communication means is longer than the data length of the public key, and for exchanging, by using the second communication means (205, 206), the public key in a case where the determination means determines that the payload length transmittable by the first communication means is not longer than the data length of the public key; and execution means for executing the parameter exchange processing using the public key by using the second communication means (205, 206).