Beispiel #1
0
/// TODO: comment
///
/// @throws SignatureException on a problem in signature
void digidoc::SignatureBES::checkQualifyingProperties() const throw(SignatureException)
{
    dsig::ObjectType::QualifyingPropertiesSequence const& qProps = signature->object()[0].qualifyingProperties();

    if ( qProps.size() != 1 )
    {
        THROW_SIGNATUREEXCEPTION("Number of QualifyingProperties is %d, must be 1", qProps.size());
    }

    if ( qProps[0].target() != "#" + signature->id().get() )
    {
        THROW_SIGNATUREEXCEPTION("QualifyingProperties target is not Signature");
    }

    checkSignedSignatureProperties();

    if ( qProps[0].unsignedProperties().present() )
    {
        xades::QualifyingPropertiesType::UnsignedPropertiesType uProps = qProps[0].unsignedProperties().get();
        if ( uProps.unsignedDataObjectProperties().present() )
        {
            THROW_SIGNATUREEXCEPTION("unexpected UnsignedDataObjectProperties in Signature");
        }
        if ( !uProps.unsignedSignatureProperties().present() )
        {
            THROW_SIGNATUREEXCEPTION("UnsignedProperties must contain UnsignedSignatureProperties");
        }
    }
}
void bdoc::XAdES132Signature::checkQualifyingProperties() const
{
    dsig::ObjectType::QualifyingPropertiesSequence const&
    qProps = _sign->object()[0].qualifyingProperties();

    if (qProps.size() != 1) {
        THROW_STACK_EXCEPTION(
            "Number of QualifyingProperties is %d, must be 1",
            qProps.size());
    }

    if (qProps[0].target() != "#" + _sign->id().get()) {
        THROW_STACK_EXCEPTION(
            "QualifyingProperties target is not Signature");
    }

    checkSignedSignatureProperties();

    if (qProps[0].unsignedProperties().present()) {
        xades132::QualifyingPropertiesType::UnsignedPropertiesType
        uProps = qProps[0].unsignedProperties().get();
        if (uProps.unsignedDataObjectProperties().present()) {
            THROW_STACK_EXCEPTION(
                "unexpected UnsignedDataObjectProperties in "
                "Signature");
        }
    }
}