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); }
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); }
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); }