Example #1
0
  /**
   * Initialises it with the parameters contained by the cryptoAttribute.
   *
   * @param cryptoAttribute The cryptoAttribute containing the crypto-suite, key-params,
   *     session-params and key information.
   */
  private void initialize(SrtpCryptoAttribute cryptoAttribute) {
    // Encode the tag element.
    this.setTag(Integer.toString(cryptoAttribute.getTag()));

    // Encode the crypto-suite element.
    this.setCryptoSuite(cryptoAttribute.getCryptoSuite().encode());

    // Encode the key-params element.
    this.setKeyParams(cryptoAttribute.getKeyParamsString());

    // Encode the session-params element (optional).
    String sessionParamsString = cryptoAttribute.getSessionParamsString();
    if (sessionParamsString != null) {
      this.setSessionParams(sessionParamsString);
    }
  }
Example #2
0
 /**
  * Returns a SrtpCryptoAttribute corresponding to this CryptoPAcketExtension.
  *
  * @return A SrtpCryptoAttribute corresponding to this CryptoPAcketExtension.
  */
 public SrtpCryptoAttribute toSrtpCryptoAttribute() {
   // Creaates the new SrtpCryptoAttribute.
   return SrtpCryptoAttribute.create(
       this.getTag(), this.getCryptoSuite(), this.getKeyParams(), this.getSessionParams());
 }