[Libreoffice-commits] core.git: 3 commits - xmlsecurity/inc xmlsecurity/source xmlsecurity/uiconfig
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jan 5 05:56:04 PST 2016
xmlsecurity/inc/xmlsecurity/sigstruct.hxx | 13 +-
xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 9 +
xmlsecurity/source/helper/documentsignaturehelper.cxx | 4
xmlsecurity/source/helper/xsecctl.cxx | 4
xmlsecurity/source/helper/xsecctl.hxx | 2
xmlsecurity/source/helper/xsecparser.cxx | 106 ++++++++---------
xmlsecurity/source/helper/xsecsign.cxx | 6
xmlsecurity/source/helper/xsecverify.cxx | 6
xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui | 13 ++
9 files changed, 92 insertions(+), 71 deletions(-)
New commits:
commit 59269d02adcfc3b892438c3ba7ad18eba1be36ce
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jan 5 14:39:00 2016 +0100
xmlsecurity: show signature description in DigitalSignaturesDialog
Change-Id: Ic98c731eb381ee3b6ff198381b63e48b786e3fe6
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index f1928c8..872cd90 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -201,11 +201,13 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
m_pSignaturesLB = VclPtr<SvSimpleTable>::Create(*pSignatures);
// #i48253# the tablistbox needs its own unique id
m_pSignaturesLB->Window::SetUniqueId( HID_XMLSEC_TREE_SIGNATURESDLG );
- static long aTabs[] = { 4, 0, 6*nControlWidth/100, 36*nControlWidth/100, 74*nControlWidth/100 };
+ // Give the first column 6 percent, try to distribute the rest equally.
+ static long aTabs[] = { 5, 0, 6*nControlWidth/100, 30*nControlWidth/100, 54*nControlWidth/100, 78*nControlWidth/100 };
m_pSignaturesLB->SetTabs(aTabs);
m_pSignaturesLB->InsertHeaderEntry("\t" + get<FixedText>("signed")->GetText() + "\t"
- + get<FixedText>("issued")->GetText() + "\t" + get<FixedText>("date")->GetText());
+ + get<FixedText>("issued")->GetText() + "\t" + get<FixedText>("date")->GetText() + "\t"
+ + get<FixedText>("description")->GetText());
mbVerifySignatures = true;
mbSignaturesChanged = false;
@@ -618,6 +620,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
OUString aSubject;
OUString aIssuer;
OUString aDateTimeStr;
+ OUString aDescription;
bool bSigValid = false;
bool bCertValid = false;
@@ -641,6 +644,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
aIssuer = XmlSec::GetContentPart( xCert->getIssuerName() );
// String with date and time information (#i20172#)
aDateTimeStr = XmlSec::GetDateTimeString( rInfo.stDateTime );
+ aDescription = rInfo.ouDescription;
}
bSigValid = ( rInfo.nStatus == ::com::sun::star::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED );
@@ -687,6 +691,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
m_pSignaturesLB->SetEntryText( aSubject, pEntry, 1 );
m_pSignaturesLB->SetEntryText( aIssuer, pEntry, 2 );
m_pSignaturesLB->SetEntryText( aDateTimeStr, pEntry, 3 );
+ m_pSignaturesLB->SetEntryText(aDescription, pEntry, 4);
pEntry->SetUserData( reinterpret_cast<void*>(n) ); // missuse user data as index
}
}
diff --git a/xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui b/xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui
index f5b7d73..4eebb5e 100644
--- a/xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui
+++ b/xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui
@@ -192,6 +192,19 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="description">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Description</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
commit ee2b08ed8a1a6a588b01d6c5e845fc92c651af5d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jan 5 10:38:39 2016 +0100
xmlsecurity: convert TYPE_...__REFERENCE constants to scoped enum
Change-Id: Ic2248b3bc6460e65bdf4eb30af4f8893a7f0e68d
diff --git a/xmlsecurity/inc/xmlsecurity/sigstruct.hxx b/xmlsecurity/inc/xmlsecurity/sigstruct.hxx
index ea0e0f3..f798b3b 100644
--- a/xmlsecurity/inc/xmlsecurity/sigstruct.hxx
+++ b/xmlsecurity/inc/xmlsecurity/sigstruct.hxx
@@ -29,17 +29,20 @@
/*
* type of reference
*/
-#define TYPE_SAMEDOCUMENT_REFERENCE 1
-#define TYPE_BINARYSTREAM_REFERENCE 2
-#define TYPE_XMLSTREAM_REFERENCE 3
+enum class SignatureReferenceType
+{
+ SAMEDOCUMENT = 1,
+ BINARYSTREAM = 2,
+ XMLSTREAM = 3
+};
struct SignatureReferenceInformation
{
- sal_Int32 nType;
+ SignatureReferenceType nType;
OUString ouURI;
OUString ouDigestValue;
- SignatureReferenceInformation( sal_Int32 type, const OUString& uri )
+ SignatureReferenceInformation( SignatureReferenceType type, const OUString& uri )
{
nType = type;
ouURI = uri;
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index 3b44a40..08a4f0b 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -341,8 +341,8 @@ bool DocumentSignatureHelper::checkIfAllFilesAreSigned(
for ( int i = sigInfo.vSignatureReferenceInfors.size(); i; )
{
const SignatureReferenceInformation& rInf = sigInfo.vSignatureReferenceInfors[--i];
- // There is also an extra entry of type TYPE_SAMEDOCUMENT_REFERENCE because of signature date.
- if ( ( rInf.nType == TYPE_BINARYSTREAM_REFERENCE ) || ( rInf.nType == TYPE_XMLSTREAM_REFERENCE ) )
+ // There is also an extra entry of type SignatureReferenceType::SAMEDOCUMENT because of signature date.
+ if ( ( rInf.nType == SignatureReferenceType::BINARYSTREAM ) || ( rInf.nType == SignatureReferenceType::XMLSTREAM ) )
{
OUString sReferenceURI = rInf.ouURI;
if (alg == OOo2Document)
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index eed58b5..2cdfbb1 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -778,7 +778,7 @@ void XSecController::exportSignature(
const SignatureReferenceInformation& refInfor = vReferenceInfors[j];
pAttributeList = new SvXMLAttributeList();
- if ( refInfor.nType != TYPE_SAMEDOCUMENT_REFERENCE )
+ if ( refInfor.nType != SignatureReferenceType::SAMEDOCUMENT )
/*
* stream reference
*/
@@ -800,7 +800,7 @@ void XSecController::exportSignature(
xDocumentHandler->startElement( tag_Reference, cssu::Reference< cssxs::XAttributeList > (pAttributeList) );
{
/* Write Transforms element */
- if (refInfor.nType == TYPE_XMLSTREAM_REFERENCE)
+ if (refInfor.nType == SignatureReferenceType::XMLSTREAM)
/*
* xml stream, so c14n transform is needed
*/
diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx
index dcb4eaa..b19ee70 100644
--- a/xmlsecurity/source/helper/xsecctl.hxx
+++ b/xmlsecurity/source/helper/xsecctl.hxx
@@ -130,7 +130,7 @@ public:
xReferenceResolvedListener = xListener;
}
- void addReference( sal_Int32 type, const OUString& uri, sal_Int32 keeperId )
+ void addReference( SignatureReferenceType type, const OUString& uri, sal_Int32 keeperId )
{
signatureInfor.vSignatureReferenceInfors.push_back(
SignatureReferenceInformation(type, uri));
diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx
index 25ba21e..29ea604 100644
--- a/xmlsecurity/source/helper/xsecsign.cxx
+++ b/xmlsecurity/source/helper/xsecsign.cxx
@@ -165,14 +165,14 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
internalSignatureInfor.signatureInfor.ouSignatureId = createId();
internalSignatureInfor.signatureInfor.ouPropertyId = createId();
- internalSignatureInfor.addReference(TYPE_SAMEDOCUMENT_REFERENCE, internalSignatureInfor.signatureInfor.ouPropertyId, -1 );
+ internalSignatureInfor.addReference(SignatureReferenceType::SAMEDOCUMENT, internalSignatureInfor.signatureInfor.ouPropertyId, -1 );
size++;
if (!internalSignatureInfor.signatureInfor.ouDescription.isEmpty())
{
// Only mention the hash of the description in the signature if it's non-empty.
internalSignatureInfor.signatureInfor.ouDescriptionPropertyId = createId();
- internalSignatureInfor.addReference(TYPE_SAMEDOCUMENT_REFERENCE, internalSignatureInfor.signatureInfor.ouDescriptionPropertyId, -1);
+ internalSignatureInfor.addReference(SignatureReferenceType::SAMEDOCUMENT, internalSignatureInfor.signatureInfor.ouDescriptionPropertyId, -1);
size++;
}
@@ -192,7 +192,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
void XSecController::signAStream( sal_Int32 securityId, const OUString& uri, const OUString& /*objectURL*/, bool isBinary)
{
- sal_Int32 type = isBinary ? TYPE_BINARYSTREAM_REFERENCE : TYPE_XMLSTREAM_REFERENCE;
+ SignatureReferenceType type = isBinary ? SignatureReferenceType::BINARYSTREAM : SignatureReferenceType::XMLSTREAM;
int index = findSignatureInfor( securityId );
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx
index a3fa87a..6f09354 100644
--- a/xmlsecurity/source/helper/xsecverify.cxx
+++ b/xmlsecurity/source/helper/xsecverify.cxx
@@ -119,14 +119,14 @@ void XSecController::addReference( const OUString& ouUri)
return;
}
InternalSignatureInformation &isi = m_vInternalSignatureInformations.back();
- isi.addReference(TYPE_SAMEDOCUMENT_REFERENCE,ouUri, -1 );
+ isi.addReference(SignatureReferenceType::SAMEDOCUMENT,ouUri, -1 );
}
void XSecController::addStreamReference(
const OUString& ouUri,
bool isBinary )
{
- sal_Int32 type = (isBinary?TYPE_BINARYSTREAM_REFERENCE:TYPE_XMLSTREAM_REFERENCE);
+ SignatureReferenceType type = (isBinary?SignatureReferenceType::BINARYSTREAM:SignatureReferenceType::XMLSTREAM);
if (m_vInternalSignatureInformations.empty())
{
@@ -173,7 +173,7 @@ void XSecController::setReferenceCount() const
for(int i=0 ; i<refNum; ++i)
{
- if (refInfors[i].nType == TYPE_SAMEDOCUMENT_REFERENCE )
+ if (refInfors[i].nType == SignatureReferenceType::SAMEDOCUMENT )
/*
* same-document reference
*/
commit 9adca57fda39c0e5cfdd7b1d9232ed4bf7f04845
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jan 5 10:35:27 2016 +0100
xmlsecurity: indentation fixes
Change-Id: I2125d23a535891c0269f12e5abfbe72fa5422393
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index b7d3734..3118f3e 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -125,64 +125,64 @@ void SAL_CALL XSecParser::startElement(
m_bReferenceUnresolved = true;
}
}
- else if (aName == TAG_TRANSFORM)
- {
+ else if (aName == TAG_TRANSFORM)
+ {
if ( m_bReferenceUnresolved )
{
OUString ouAlgorithm = xAttribs->getValueByName(ATTR_ALGORITHM);
if (ouAlgorithm != nullptr && ouAlgorithm == ALGO_C14N)
- /*
- * a xml stream
- */
+ /*
+ * a xml stream
+ */
{
m_pXSecController->addStreamReference( m_currentReferenceURI, false);
m_bReferenceUnresolved = false;
}
}
- }
- else if (aName == TAG_X509ISSUERNAME)
- {
+ }
+ else if (aName == TAG_X509ISSUERNAME)
+ {
m_ouX509IssuerName.clear();
m_bInX509IssuerName = true;
- }
- else if (aName == TAG_X509SERIALNUMBER)
- {
+ }
+ else if (aName == TAG_X509SERIALNUMBER)
+ {
m_ouX509SerialNumber.clear();
m_bInX509SerialNumber = true;
- }
- else if (aName == TAG_X509CERTIFICATE)
- {
+ }
+ else if (aName == TAG_X509CERTIFICATE)
+ {
m_ouX509Certificate.clear();
m_bInX509Certificate = true;
- }
- else if (aName == TAG_SIGNATUREVALUE)
- {
+ }
+ else if (aName == TAG_SIGNATUREVALUE)
+ {
m_ouSignatureValue.clear();
- m_bInSignatureValue = true;
- }
- else if (aName == TAG_DIGESTVALUE)
- {
- m_ouDigestValue.clear();
- m_bInDigestValue = true;
- }
- else if ( aName == TAG_SIGNATUREPROPERTY )
+ m_bInSignatureValue = true;
+ }
+ else if (aName == TAG_DIGESTVALUE)
+ {
+ m_ouDigestValue.clear();
+ m_bInDigestValue = true;
+ }
+ else if ( aName == TAG_SIGNATUREPROPERTY )
{
if (ouIdAttr != nullptr)
{
m_pXSecController->setPropertyId( ouIdAttr );
}
}
- else if (aName == NSTAG_DC ":" TAG_DATE)
- {
+ else if (aName == NSTAG_DC ":" TAG_DATE)
+ {
m_ouDate.clear();
- m_bInDate = true;
- }
- else if (aName == NSTAG_DC ":" TAG_DESCRIPTION)
- {
- m_ouDescription.clear();
- m_bInDescription = true;
- }
+ m_bInDate = true;
+ }
+ else if (aName == NSTAG_DC ":" TAG_DESCRIPTION)
+ {
+ m_ouDescription.clear();
+ m_bInDescription = true;
+ }
if (m_xNextHandler.is())
{
@@ -235,31 +235,31 @@ void SAL_CALL XSecParser::endElement( const OUString& aName )
m_pXSecController->setSignatureValue( m_ouSignatureValue );
m_bInSignatureValue = false;
}
- else if (aName == TAG_X509ISSUERNAME)
- {
+ else if (aName == TAG_X509ISSUERNAME)
+ {
m_pXSecController->setX509IssuerName( m_ouX509IssuerName );
m_bInX509IssuerName = false;
- }
- else if (aName == TAG_X509SERIALNUMBER)
- {
+ }
+ else if (aName == TAG_X509SERIALNUMBER)
+ {
m_pXSecController->setX509SerialNumber( m_ouX509SerialNumber );
m_bInX509SerialNumber = false;
- }
- else if (aName == TAG_X509CERTIFICATE)
- {
+ }
+ else if (aName == TAG_X509CERTIFICATE)
+ {
m_pXSecController->setX509Certificate( m_ouX509Certificate );
m_bInX509Certificate = false;
- }
- else if (aName == NSTAG_DC ":" TAG_DATE)
+ }
+ else if (aName == NSTAG_DC ":" TAG_DATE)
{
m_pXSecController->setDate( m_ouDate );
m_bInDate = false;
}
- else if (aName == NSTAG_DC ":" TAG_DESCRIPTION)
- {
- m_pXSecController->setDescription( m_ouDescription );
- m_bInDescription = false;
- }
+ else if (aName == NSTAG_DC ":" TAG_DESCRIPTION)
+ {
+ m_pXSecController->setDescription( m_ouDescription );
+ m_bInDescription = false;
+ }
if (m_xNextHandler.is())
{
@@ -316,7 +316,7 @@ void SAL_CALL XSecParser::characters( const OUString& aChars )
if (m_xNextHandler.is())
{
m_xNextHandler->characters(aChars);
- }
+ }
}
void SAL_CALL XSecParser::ignorableWhitespace( const OUString& aWhitespaces )
@@ -325,7 +325,7 @@ void SAL_CALL XSecParser::ignorableWhitespace( const OUString& aWhitespaces )
if (m_xNextHandler.is())
{
m_xNextHandler->ignorableWhitespace( aWhitespaces );
- }
+ }
}
void SAL_CALL XSecParser::processingInstruction( const OUString& aTarget, const OUString& aData )
@@ -334,7 +334,7 @@ void SAL_CALL XSecParser::processingInstruction( const OUString& aTarget, const
if (m_xNextHandler.is())
{
m_xNextHandler->processingInstruction(aTarget, aData);
- }
+ }
}
void SAL_CALL XSecParser::setDocumentLocator( const cssu::Reference< cssxs::XLocator >& xLocator )
@@ -343,7 +343,7 @@ void SAL_CALL XSecParser::setDocumentLocator( const cssu::Reference< cssxs::XLoc
if (m_xNextHandler.is())
{
m_xNextHandler->setDocumentLocator( xLocator );
- }
+ }
}
/*
More information about the Libreoffice-commits
mailing list