Kaydet (Commit) cf87468f authored tarafından Michael Mi's avatar Michael Mi

add more detailed certificate information:

1) signature algorithm
2) subject public key algorithm
3) subject public key value
4) thumbprint (not implemented)
5) thumbprint algorithm (not implemented)

Issue number:
Submitted by:
Reviewed by:
üst 45f8145b
......@@ -2,9 +2,9 @@
*
* $RCSfile: x509certificate_mscryptimpl.cxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: mt $ $Date: 2004-07-12 13:15:22 $
* last change: $Author: mmi $ $Date: 2004-07-14 08:12:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -390,3 +390,69 @@ X509Certificate_MSCryptImpl* X509Certificate_MSCryptImpl :: getImplementation( c
return NULL ;
}
// MM : added by MM
::rtl::OUString SAL_CALL X509Certificate_MSCryptImpl::getSubjectPublicKeyAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException)
{
if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL )
{
CRYPT_ALGORITHM_IDENTIFIER algorithm = m_pCertContext->pCertInfo->SubjectPublicKeyInfo.Algorithm;
return OUString::createFromAscii( algorithm.pszObjId ) ;
}
else
{
return OUString() ;
}
}
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getSubjectPublicKeyValue()
throw ( ::com::sun::star::uno::RuntimeException)
{
if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL )
{
CRYPT_BIT_BLOB publicKey = m_pCertContext->pCertInfo->SubjectPublicKeyInfo.PublicKey;
Sequence< sal_Int8 > key( publicKey.cbData ) ;
for( unsigned int i = 0 ; i < publicKey.cbData ; i++ )
{
key[i] = *(publicKey.pbData + i) ;
}
return key;
}
else
{
return NULL ;
}
}
::rtl::OUString SAL_CALL X509Certificate_MSCryptImpl::getSignatureAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException)
{
if( m_pCertContext != NULL && m_pCertContext->pCertInfo != NULL )
{
CRYPT_ALGORITHM_IDENTIFIER algorithm = m_pCertContext->pCertInfo->SignatureAlgorithm;
return OUString::createFromAscii( algorithm.pszObjId ) ;
}
else
{
return OUString() ;
}
}
::rtl::OUString SAL_CALL X509Certificate_MSCryptImpl::getThumbprintAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException)
{
//MM : dummy
return OUString();
}
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_MSCryptImpl::getThumbprint()
throw ( ::com::sun::star::uno::RuntimeException)
{
//MM : dummy
return NULL ;
}
// MM : end
......@@ -2,9 +2,9 @@
*
* $RCSfile: x509certificate_mscryptimpl.hxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: mt $ $Date: 2004-07-12 13:15:22 $
* last change: $Author: mmi $ $Date: 2004-07-14 08:12:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -131,6 +131,24 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper2<
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getEncoded() throw ( ::com::sun::star::uno::RuntimeException) ;
// MM : added by MM
virtual ::rtl::OUString SAL_CALL getSubjectPublicKeyAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue()
throw ( ::com::sun::star::uno::RuntimeException) ;
virtual ::rtl::OUString SAL_CALL getSignatureAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException) ;
virtual ::rtl::OUString SAL_CALL getThumbprintAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getThumbprint()
throw ( ::com::sun::star::uno::RuntimeException) ;
// MM : end
//Methods from XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (com::sun::star::uno::RuntimeException);
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: x509certificate_nssimpl.cxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: mt $ $Date: 2004-07-12 13:15:21 $
* last change: $Author: mmi $ $Date: 2004-07-14 08:12:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -79,6 +79,11 @@
#include "nss.h"
#include "secder.h"
//MM : added by MM
#include "secoid.h"
//MM : end
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::security ;
using ::rtl::OUString ;
......@@ -358,3 +363,79 @@ X509Certificate_NssImpl* X509Certificate_NssImpl :: getImplementation( const Ref
return NULL ;
}
// MM : added by MM
::rtl::OUString getAlgorithmDescription(SECAlgorithmID *aid)
{
SECOidTag tag;
tag = SECOID_GetAlgorithmTag(aid);
const char *pDesc = SECOID_FindOIDTagDescription(tag);
return rtl::OUString::createFromAscii( pDesc ) ;
}
::rtl::OUString SAL_CALL X509Certificate_NssImpl::getSubjectPublicKeyAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException)
{
if( m_pCert != NULL )
{
return getAlgorithmDescription(&(m_pCert->subjectPublicKeyInfo.algorithm));
}
else
{
return OUString() ;
}
}
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_NssImpl::getSubjectPublicKeyValue()
throw ( ::com::sun::star::uno::RuntimeException)
{
if( m_pCert != NULL )
{
SECItem spk = m_pCert->subjectPublicKeyInfo.subjectPublicKey;
DER_ConvertBitString(&spk);
if ( spk.len>0)
{
Sequence< sal_Int8 > key( spk.len ) ;
for( unsigned int i = 0 ; i < spk.len ; i ++ )
{
key[i] = *( spk.data + i ) ;
}
return key ;
}
}
return NULL ;
}
::rtl::OUString SAL_CALL X509Certificate_NssImpl::getSignatureAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException)
{
if( m_pCert != NULL )
{
return getAlgorithmDescription(&(m_pCert->signature));
}
else
{
return OUString() ;
}
}
::rtl::OUString SAL_CALL X509Certificate_NssImpl::getThumbprintAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException)
{
//MM : dummy
return OUString();
}
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL X509Certificate_NssImpl::getThumbprint()
throw ( ::com::sun::star::uno::RuntimeException)
{
//MM : dummy
return NULL ;
}
// MM : end
......@@ -2,9 +2,9 @@
*
* $RCSfile: x509certificate_nssimpl.hxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: mt $ $Date: 2004-07-12 13:15:21 $
* last change: $Author: mmi $ $Date: 2004-07-14 08:12:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -130,6 +130,23 @@ class X509Certificate_NssImpl : public ::cppu::WeakImplHelper2<
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getEncoded( ) throw ( ::com::sun::star::uno::RuntimeException) ;
// MM : added by MM
virtual ::rtl::OUString SAL_CALL getSubjectPublicKeyAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getSubjectPublicKeyValue()
throw ( ::com::sun::star::uno::RuntimeException) ;
virtual ::rtl::OUString SAL_CALL getSignatureAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException) ;
virtual ::rtl::OUString SAL_CALL getThumbprintAlgorithm()
throw ( ::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getThumbprint()
throw ( ::com::sun::star::uno::RuntimeException) ;
// MM : end
//Methods from XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (com::sun::star::uno::RuntimeException);
......
......@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
# $Revision: 1.2 $
#
# last change: $Author: mt $ $Date: 2004-07-12 13:15:30 $
# last change: $Author: mmi $ $Date: 2004-07-14 08:12:30 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
......@@ -92,9 +92,9 @@ SHARE_LIBS = \
.IF "$(GUI)"=="WNT"
SHARE_LIBS+= "ixml2.lib" "nss3.lib" "nspr4.lib" "xmlsec.lib" "xmlsec-nss.lib" "xsecctl.lib" "helper.lib" "xsec_xmlsec.lib"
SHARE_LIBS+= "ixml2.lib" "nss3.lib" "nspr4.lib" "xmlsec.lib" "xmlsec-nss.lib" "helper.lib" "xsec_xmlsec.lib"
.ELSE
SHARE_LIBS+= "-lxml2" "-lnss3" "-lnspr4" "-lxmlsec" "-lxmlsec-nss" "-lxsecctl" "-lhelper" "-lxsec_xmlsec"
SHARE_LIBS+= "-lxml2" "-lnss3" "-lnspr4" "-lxmlsec" "-lxmlsec-nss" "-lhelper" "-lxsec_xmlsec"
.ENDIF
SHARE_OBJS = \
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: util.cxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: mt $ $Date: 2004-07-12 13:15:30 $
* last change: $Author: mmi $ $Date: 2004-07-14 08:12:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -185,7 +185,23 @@ cssu::Reference< cssl::XMultiServiceFactory > serviceManager(
for( int i = 0; i < xCertPath.getLength(); i++ )
{
result += xCertPath[i]->getSubjectName();
result += rtl::OUString::createFromAscii( " << " );
result += rtl::OUString::createFromAscii( "\n Subject public key algorithm : " );
result += xCertPath[i]->getSubjectPublicKeyAlgorithm();
result += rtl::OUString::createFromAscii( "\n Signature algorithm : " );
result += xCertPath[i]->getSignatureAlgorithm();
result += rtl::OUString::createFromAscii( "\n Subject public key value : " );
cssu::Sequence< sal_Int8 > keyValue = xCertPath[i]->getSubjectPublicKeyValue();
int length = keyValue.getLength();
char number[64];
for (int j=0; j<length; j++)
{
sprintf(number, "%02X ", (unsigned char)keyValue[j]);
result += rtl::OUString::createFromAscii( number );
}
result += rtl::OUString::createFromAscii( "\n <<\n" );
}
result += rtl::OUString::createFromAscii( "\n" );
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: util.hxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: mt $ $Date: 2004-07-12 13:15:30 $
* last change: $Author: mmi $ $Date: 2004-07-14 08:12:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -68,7 +68,7 @@
#include <xmlsecurity/xmlsignaturehelper.hxx>
#include <drafts/com/sun/star/xml/crypto/XUriBinding.hpp>
#include <com/sun/star/xml/crypto/XUriBinding.hpp>
/*
* get service manager and context
......@@ -83,5 +83,5 @@
::rtl::OUString getSignatureInformations(
const SignatureInformations& SignatureInformations,
::com::sun::star::uno::Reference< ::drafts::com::sun::star::xml::crypto::XSecurityEnvironment >& xSecurityEnvironment );
::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment >& xSecurityEnvironment );
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment