예제 #1
0
 /// <summary>
 /// Create a SigningInfo with the signerType and signerName, with other default
 /// values. The digest algorithm is set to DigestAlgorithm.SHA256.
 /// </summary>
 ///
 /// <param name="signerType">The type of signer.</param>
 /// <param name="signerName"></param>
 public SigningInfo(SigningInfo.SignerType signerType, Name signerName)
 {
     this.validityPeriod_ = new ValidityPeriod();
     reset(signerType);
     name_            = new Name(signerName);
     digestAlgorithm_ = net.named_data.jndn.security.DigestAlgorithm.SHA256;
 }
예제 #2
0
        /// <summary>
        /// Check and set the signerType, and set others to default values. This does
        /// NOT reset the digest algorithm.
        /// </summary>
        ///
        /// <param name="signerType">The The type of signer.</param>
        private void reset(SigningInfo.SignerType signerType)
        {
            if (!(signerType == net.named_data.jndn.security.SigningInfo.SignerType.NULL || signerType == net.named_data.jndn.security.SigningInfo.SignerType.ID ||
                  signerType == net.named_data.jndn.security.SigningInfo.SignerType.KEY ||
                  signerType == net.named_data.jndn.security.SigningInfo.SignerType.CERT || signerType == net.named_data.jndn.security.SigningInfo.SignerType.SHA256))
            {
                throw new AssertionError("SigningInfo: The signerType is not valid");
            }

            type_           = signerType;
            name_           = new Name();
            identity_       = null;
            key_            = null;
            validityPeriod_ = new ValidityPeriod();
        }