Beispiel #1
0
        public void Read_WithEmptyQualifiers_Throws()
        {
            var bcCommitmentTypeIndication = new BcCommitmentTypeIndication(
                PkcsObjectIdentifiers.IdCtiEtsProofOfSender,
                DerSequence.Empty);
            var bytes = bcCommitmentTypeIndication.GetDerEncoded();

            var exception = Assert.Throws <SignatureException>(
                () => CommitmentTypeIndication.Read(bytes));

            Assert.Equal("The commitment-type-indication attribute is invalid.", exception.Message);
        }
Beispiel #2
0
        public void Read_WithOnlyCommitmentTypeId_ReturnsInstance()
        {
            var bcCommitmentTypeIndication = new BcCommitmentTypeIndication(PkcsObjectIdentifiers.IdCtiEtsProofOfSender);
            var bytes = bcCommitmentTypeIndication.GetDerEncoded();

            var commitmentTypeIndication = CommitmentTypeIndication.Read(bytes);

            Assert.Equal(
                bcCommitmentTypeIndication.CommitmentTypeID.ToString(),
                commitmentTypeIndication.CommitmentTypeId.Value);
            Assert.Null(commitmentTypeIndication.Qualifiers);
        }
Beispiel #3
0
        public void Read_WithQualifiers_ReturnsInstance()
        {
            var commitmentTypeIdentifier   = new DerObjectIdentifier("1.2.3");
            var bcCommitmentTypeQualifier  = new BcCommitmentTypeQualifier(commitmentTypeIdentifier);
            var bcCommitmentTypeIndication = new BcCommitmentTypeIndication(
                PkcsObjectIdentifiers.IdCtiEtsProofOfSender,
                new DerSequence(bcCommitmentTypeQualifier));
            var bytes = bcCommitmentTypeIndication.GetDerEncoded();

            var commitmentTypeIndication = CommitmentTypeIndication.Read(bytes);

            Assert.Equal(1, commitmentTypeIndication.Qualifiers.Count);
            Assert.Equal(commitmentTypeIdentifier.ToString(), commitmentTypeIndication.Qualifiers[0].CommitmentTypeIdentifier.Value);
        }