You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2006/03/05 11:20:09 UTC
svn commit: r383302 [1/2] - in /xml/security/trunk/c:
Projects/VC6.0/xsec/xsec_lib/ src/tools/xklient/ src/xkms/ src/xkms/impl/
Author: blautenb
Date: Sun Mar 5 02:20:07 2006
New Revision: 383302
URL: http://svn.apache.org/viewcvs?rev=383302&view=rev
Log:
Support for Recover and Reissue XKRSS messages
Added:
xml/security/trunk/c/src/xkms/XKMSRecoverKeyBinding.hpp
xml/security/trunk/c/src/xkms/XKMSRecoverRequest.hpp
xml/security/trunk/c/src/xkms/XKMSRecoverResult.hpp
xml/security/trunk/c/src/xkms/XKMSReissueKeyBinding.hpp
xml/security/trunk/c/src/xkms/XKMSReissueRequest.hpp
xml/security/trunk/c/src/xkms/XKMSReissueResult.hpp
xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.cpp
xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.hpp
xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.cpp
xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.hpp
xml/security/trunk/c/src/xkms/impl/XKMSRecoverResultImpl.cpp
xml/security/trunk/c/src/xkms/impl/XKMSRecoverResultImpl.hpp
xml/security/trunk/c/src/xkms/impl/XKMSReissueKeyBindingImpl.cpp
xml/security/trunk/c/src/xkms/impl/XKMSReissueKeyBindingImpl.hpp
xml/security/trunk/c/src/xkms/impl/XKMSReissueRequestImpl.cpp
xml/security/trunk/c/src/xkms/impl/XKMSReissueRequestImpl.hpp
xml/security/trunk/c/src/xkms/impl/XKMSReissueResultImpl.cpp
xml/security/trunk/c/src/xkms/impl/XKMSReissueResultImpl.hpp
Modified:
xml/security/trunk/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp
xml/security/trunk/c/src/tools/xklient/xklient.cpp
xml/security/trunk/c/src/xkms/XKMSConstants.cpp
xml/security/trunk/c/src/xkms/XKMSConstants.hpp
xml/security/trunk/c/src/xkms/XKMSMessageAbstractType.hpp
xml/security/trunk/c/src/xkms/XKMSMessageFactory.hpp
xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.cpp
xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.hpp
Modified: xml/security/trunk/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp?rev=383302&r1=383301&r2=383302&view=diff
==============================================================================
--- xml/security/trunk/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp (original)
+++ xml/security/trunk/c/Projects/VC6.0/xsec/xsec_lib/xsec_lib.dsp Sun Mar 5 02:20:07 2006
@@ -1276,6 +1276,30 @@
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\src\xkms\impl\XKMSRecoverKeyBindingImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSRecoverKeyBindingImpl.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSRecoverRequestImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSRecoverRequestImpl.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSRecoverResultImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSRecoverResultImpl.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xkms\impl\XKMSRegisterRequestImpl.cpp
# End Source File
# Begin Source File
@@ -1292,6 +1316,30 @@
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\src\xkms\impl\XKMSReissueKeyBindingImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSReissueKeyBindingImpl.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSReissueRequestImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSReissueRequestImpl.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSReissueResultImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\impl\XKMSReissueResultImpl.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xkms\impl\XKMSRequestAbstractTypeImpl.cpp
# End Source File
# Begin Source File
@@ -1489,11 +1537,35 @@
# End Source File
# Begin Source File
+SOURCE=..\..\..\..\src\xkms\XKMSRecoverKeyBinding.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\XKMSRecoverRequest.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\XKMSRecoverResult.hpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\..\src\xkms\XKMSRegisterRequest.hpp
# End Source File
# Begin Source File
SOURCE=..\..\..\..\src\xkms\XKMSRegisterResult.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\XKMSReissueKeyBinding.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\XKMSReissueRequest.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\xkms\XKMSReissueResult.hpp
# End Source File
# Begin Source File
Modified: xml/security/trunk/c/src/tools/xklient/xklient.cpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/tools/xklient/xklient.cpp?rev=383302&r1=383301&r2=383302&view=diff
==============================================================================
--- xml/security/trunk/c/src/tools/xklient/xklient.cpp (original)
+++ xml/security/trunk/c/src/tools/xklient/xklient.cpp Sun Mar 5 02:20:07 2006
@@ -61,7 +61,13 @@
#include <xsec/xkms/XKMSPrototypeKeyBinding.hpp>
#include <xsec/xkms/XKMSRevokeRequest.hpp>
#include <xsec/xkms/XKMSRevokeResult.hpp>
+#include <xsec/xkms/XKMSRecoverRequest.hpp>
+#include <xsec/xkms/XKMSRecoverResult.hpp>
+#include <xsec/xkms/XKMSReissueRequest.hpp>
+#include <xsec/xkms/XKMSReissueResult.hpp>
#include <xsec/xkms/XKMSRevokeKeyBinding.hpp>
+#include <xsec/xkms/XKMSRecoverKeyBinding.hpp>
+#include <xsec/xkms/XKMSReissueKeyBinding.hpp>
#include <xsec/xkms/XKMSRSAKeyPair.hpp>
#include <xsec/utils/XSECSOAPRequestorSimple.hpp>
@@ -2237,6 +2243,52 @@
}
+void doRecoverKeyBindingDump(XKMSRecoverKeyBinding * kb, int level) {
+
+ /* Dump the status */
+
+ XKMSStatus * s = kb->getStatus();
+ if (s == NULL)
+ return;
+
+ char * sr = XMLString::transcode(XKMSConstants::s_tagStatusValueCodes[s->getStatusValue()]);
+ levelSet(level);
+ cout << "Status = " << sr << endl;
+ XSEC_RELEASE_XMLCH(sr);
+
+ /* Dump the status reasons */
+ doStatusReasonDump(XKMSStatus::Valid, s, level+1);
+ doStatusReasonDump(XKMSStatus::Invalid, s, level+1);
+ doStatusReasonDump(XKMSStatus::Indeterminate, s, level+1);
+
+ /* Now the actual key */
+ doKeyBindingAbstractDump((XKMSKeyBindingAbstractType *) kb, level);
+
+}
+
+void doReissueKeyBindingDump(XKMSReissueKeyBinding * kb, int level) {
+
+ /* Dump the status */
+
+ XKMSStatus * s = kb->getStatus();
+ if (s == NULL)
+ return;
+
+ char * sr = XMLString::transcode(XKMSConstants::s_tagStatusValueCodes[s->getStatusValue()]);
+ levelSet(level);
+ cout << "Status = " << sr << endl;
+ XSEC_RELEASE_XMLCH(sr);
+
+ /* Dump the status reasons */
+ doStatusReasonDump(XKMSStatus::Valid, s, level+1);
+ doStatusReasonDump(XKMSStatus::Invalid, s, level+1);
+ doStatusReasonDump(XKMSStatus::Indeterminate, s, level+1);
+
+ /* Now the actual key */
+ doKeyBindingAbstractDump((XKMSKeyBindingAbstractType *) kb, level);
+
+}
+
void doAuthenticationDump(XKMSAuthentication *a, int level) {
@@ -2491,6 +2543,122 @@
return 0;
}
+int doRecoverResultDump(XKMSRecoverResult *msg) {
+
+ cout << endl << "This is a RecoverResult Message" << endl;
+ int level = 1;
+
+ doMessageAbstractTypeDump(msg, level);
+ doResultTypeDump(msg, level);
+
+ int j;
+
+ if ((j = msg->getKeyBindingSize()) > 0) {
+
+ cout << endl;
+ levelSet(level);
+ cout << "Key Bindings" << endl << endl;
+
+ for (int i = 0; i < j ; ++i) {
+
+ doKeyBindingDump(msg->getKeyBindingItem(i), level + 1);
+
+ }
+
+ }
+
+ // Check if there is a private key
+ if (g_authPassPhrase) {
+ XKMSRSAKeyPair * kp = msg->getRSAKeyPair(g_authPassPhrase);
+ if (kp != NULL) {
+ cout << endl;
+ levelSet(level);
+ cout << "RSAKeyPair found" << endl << endl;
+ level += 1;
+
+ // Translate the parameters to char strings
+ char * sModulus = XMLString::transcode(kp->getModulus());
+ char * sExponent = XMLString::transcode(kp->getExponent());
+ char * sP = XMLString::transcode(kp->getP());
+ char * sQ = XMLString::transcode(kp->getQ());
+ char * sDP = XMLString::transcode(kp->getDP());
+ char * sDQ = XMLString::transcode(kp->getDQ());
+ char * sInverseQ = XMLString::transcode(kp->getInverseQ());
+ char * sD = XMLString::transcode(kp->getD());
+
+#if defined (HAVE_OPENSSL)
+
+ if (g_privateKeyFile != NULL) {
+ levelSet(level);
+ cout << "Writing private key to file " << g_privateKeyFile;
+
+ // Create the RSA key file
+ RSA * rsa = RSA_new();
+ rsa->n = OpenSSLCryptoBase64::b642BN(sModulus, strlen(sModulus));
+ rsa->e = OpenSSLCryptoBase64::b642BN(sExponent, strlen(sExponent));
+ rsa->d = OpenSSLCryptoBase64::b642BN(sD, strlen(sD));
+ rsa->p = OpenSSLCryptoBase64::b642BN(sP, strlen(sP));
+ rsa->q = OpenSSLCryptoBase64::b642BN(sQ, strlen(sQ));
+ rsa->dmp1 = OpenSSLCryptoBase64::b642BN(sDP, strlen(sDP));
+ rsa->dmq1 = OpenSSLCryptoBase64::b642BN(sDQ, strlen(sDQ));
+ rsa->iqmp = OpenSSLCryptoBase64::b642BN(sInverseQ, strlen(sInverseQ));
+
+ // Write it to disk
+ BIO *out;
+ out = BIO_new_file(g_privateKeyFile, "w");
+ if(!out) cout << "Error occurred in opening file!" << endl << endl;
+ if (!PEM_write_bio_RSAPrivateKey(out, rsa, EVP_des_ede3_cbc(), NULL, 0, 0, g_privateKeyPassPhrase)) {
+ cout << "Error creating PEM output" << endl << endl;
+ }
+ BIO_free(out);
+ RSA_free(rsa);
+
+ cout << " done" << endl << endl;
+
+ }
+#endif
+ // Now output
+ levelSet(level);
+ cout << "Modulus = " << sModulus << endl;
+ XSEC_RELEASE_XMLCH(sModulus);
+
+ levelSet(level);
+ cout << "Exponent = " << sExponent << endl;
+ XSEC_RELEASE_XMLCH(sExponent);
+
+ levelSet(level);
+ cout << "P = " << sP << endl;
+ XSEC_RELEASE_XMLCH(sP);
+
+ levelSet(level);
+ cout << "Q = " << sQ << endl;
+ XSEC_RELEASE_XMLCH(sQ);
+
+ levelSet(level);
+ cout << "DP = " << sDP << endl;
+ XSEC_RELEASE_XMLCH(sDP);
+
+ levelSet(level);
+ cout << "DQ = " << sDQ << endl;
+ XSEC_RELEASE_XMLCH(sDQ);
+
+ levelSet(level);
+ cout << "Inverse Q = " << sInverseQ << endl;
+ XSEC_RELEASE_XMLCH(sInverseQ);
+
+ levelSet(level);
+ cout << "D = " << sD << endl;
+ XSEC_RELEASE_XMLCH(sD);
+ }
+ }
+ else {
+ levelSet(level);
+ cout << "Not checking for private key as no decryption phrase set";
+ }
+
+ return 0;
+}
+
int doRevokeResultDump(XKMSRevokeResult *msg) {
cout << endl << "This is a RevokeResult Message" << endl;
@@ -2518,6 +2686,33 @@
return 0;
}
+int doReissueResultDump(XKMSReissueResult *msg) {
+
+ cout << endl << "This is a ReissueResult Message" << endl;
+ int level = 1;
+
+ doMessageAbstractTypeDump(msg, level);
+ doResultTypeDump(msg, level);
+
+ int j;
+
+ if ((j = msg->getKeyBindingSize()) > 0) {
+
+ cout << endl;
+ levelSet(level);
+ cout << "Key Bindings" << endl << endl;
+
+ for (int i = 0; i < j ; ++i) {
+
+ doKeyBindingDump(msg->getKeyBindingItem(i), level + 1);
+
+ }
+
+ }
+
+ return 0;
+}
+
int doStatusResultDump(XKMSStatusResult *msg) {
cout << endl << "This is a StatusResult Message" << endl;
@@ -2627,6 +2822,76 @@
}
+int doRecoverRequestDump(XKMSRecoverRequest *msg) {
+
+ cout << endl << "This is a RecoverRequest Message" << endl;
+ int level = 1;
+
+ doMessageAbstractTypeDump(msg, level);
+ doRequestAbstractTypeDump(msg, level);
+
+ XKMSRecoverKeyBinding *rkb = msg->getRecoverKeyBinding();
+ if (rkb != NULL) {
+ doRecoverKeyBindingDump(rkb, level);
+ }
+
+ // Check authentication
+ if (msg->getAuthentication())
+ doAuthenticationDump(msg->getAuthentication(), level);
+
+ return 0;
+
+}
+
+int doReissueRequestDump(XKMSReissueRequest *msg) {
+
+ cout << endl << "This is a ReiussueRequest Message" << endl;
+ int level = 1;
+
+ doMessageAbstractTypeDump(msg, level);
+ doRequestAbstractTypeDump(msg, level);
+
+ XKMSReissueKeyBinding *rkb = msg->getReissueKeyBinding();
+ if (rkb != NULL) {
+ doReissueKeyBindingDump(rkb, level);
+ }
+
+ // Check authentication
+ doAuthenticationDump(msg->getAuthentication(), level);
+
+ // Check ProofOfPossession
+ levelSet(1);
+ DSIGSignature * sig = msg->getProofOfPossessionSignature();
+ if (sig != NULL) {
+
+ cout << "Proof of PossessionSignature signature found. Checking.... ";
+
+ // Try to find the key
+ XSECKeyInfoResolverDefault kir;
+ XSECCryptoKey * k = kir.resolveKey(rkb->getKeyInfoList());
+
+ if (k != NULL) {
+
+ sig->setSigningKey(k);
+ if (sig->verify())
+ cout << "OK!" << endl;
+ else
+ cout << "Signature Bad!" << endl;
+ }
+ else
+ cout << "Cannot obtain key from PrototypeKeyBinding" << endl;
+
+ }
+ else {
+
+ cout << "No ProofOfPossession Signature found" << endl;
+
+ }
+
+ return 0;
+
+}
+
int doMsgDump(XKMSMessageAbstractType * msg) {
if (msg->isSigned()) {
@@ -2738,6 +3003,26 @@
case XKMSMessageAbstractType::RevokeResult :
doRevokeResultDump((XKMSRevokeResult *) msg);
+ break;
+
+ case XKMSMessageAbstractType::RecoverRequest :
+
+ doRecoverRequestDump((XKMSRecoverRequest *) msg);
+ break;
+
+ case XKMSMessageAbstractType::RecoverResult :
+
+ doRecoverResultDump((XKMSRecoverResult *) msg);
+ break;
+
+ case XKMSMessageAbstractType::ReissueRequest :
+
+ doReissueRequestDump((XKMSReissueRequest *) msg);
+ break;
+
+ case XKMSMessageAbstractType::ReissueResult :
+
+ doReissueResultDump((XKMSReissueResult *) msg);
break;
default :
Modified: xml/security/trunk/c/src/xkms/XKMSConstants.cpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSConstants.cpp?rev=383302&r1=383301&r2=383302&view=diff
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSConstants.cpp (original)
+++ xml/security/trunk/c/src/xkms/XKMSConstants.cpp Sun Mar 5 02:20:07 2006
@@ -698,6 +698,65 @@
chNull
};
+const XMLCh XKMSConstants::s_tagRecoverKeyBinding[] = {
+
+ chLatin_R,
+ chLatin_e,
+ chLatin_c,
+ chLatin_o,
+ chLatin_v,
+ chLatin_e,
+ chLatin_r,
+ chLatin_K,
+ chLatin_e,
+ chLatin_y,
+ chLatin_B,
+ chLatin_i,
+ chLatin_n,
+ chLatin_d,
+ chLatin_i,
+ chLatin_n,
+ chLatin_g,
+ chNull
+};
+
+const XMLCh XKMSConstants::s_tagRecoverRequest[] = {
+
+ chLatin_R,
+ chLatin_e,
+ chLatin_c,
+ chLatin_o,
+ chLatin_v,
+ chLatin_e,
+ chLatin_r,
+ chLatin_R,
+ chLatin_e,
+ chLatin_q,
+ chLatin_u,
+ chLatin_e,
+ chLatin_s,
+ chLatin_t,
+ chNull
+};
+
+const XMLCh XKMSConstants::s_tagRecoverResult[] = {
+
+ chLatin_R,
+ chLatin_e,
+ chLatin_c,
+ chLatin_o,
+ chLatin_v,
+ chLatin_e,
+ chLatin_r,
+ chLatin_R,
+ chLatin_e,
+ chLatin_s,
+ chLatin_u,
+ chLatin_l,
+ chLatin_t,
+ chNull
+};
+
const XMLCh XKMSConstants::s_tagRegisterRequest[] = {
chLatin_R,
@@ -728,6 +787,65 @@
chLatin_t,
chLatin_e,
chLatin_r,
+ chLatin_R,
+ chLatin_e,
+ chLatin_s,
+ chLatin_u,
+ chLatin_l,
+ chLatin_t,
+ chNull
+};
+
+const XMLCh XKMSConstants::s_tagReissueKeyBinding[] = {
+
+ chLatin_R,
+ chLatin_e,
+ chLatin_i,
+ chLatin_s,
+ chLatin_s,
+ chLatin_u,
+ chLatin_e,
+ chLatin_K,
+ chLatin_e,
+ chLatin_y,
+ chLatin_B,
+ chLatin_i,
+ chLatin_n,
+ chLatin_d,
+ chLatin_i,
+ chLatin_n,
+ chLatin_g,
+ chNull
+};
+
+const XMLCh XKMSConstants::s_tagReissueRequest[] = {
+
+ chLatin_R,
+ chLatin_e,
+ chLatin_i,
+ chLatin_s,
+ chLatin_s,
+ chLatin_u,
+ chLatin_e,
+ chLatin_R,
+ chLatin_e,
+ chLatin_q,
+ chLatin_u,
+ chLatin_e,
+ chLatin_s,
+ chLatin_t,
+ chNull
+};
+
+const XMLCh XKMSConstants::s_tagReissueResult[] = {
+
+ chLatin_R,
+ chLatin_e,
+ chLatin_i,
+ chLatin_s,
+ chLatin_s,
+ chLatin_u,
+ chLatin_e,
chLatin_R,
chLatin_e,
chLatin_s,
Modified: xml/security/trunk/c/src/xkms/XKMSConstants.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSConstants.hpp?rev=383302&r1=383301&r2=383302&view=diff
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSConstants.hpp (original)
+++ xml/security/trunk/c/src/xkms/XKMSConstants.hpp Sun Mar 5 02:20:07 2006
@@ -93,8 +93,14 @@
static const XMLCh s_tagPrototypeKeyBinding[];
static const XMLCh s_tagQ[];
static const XMLCh s_tagQueryKeyBinding[];
+ static const XMLCh s_tagRecoverKeyBinding[];
+ static const XMLCh s_tagRecoverRequest[];
+ static const XMLCh s_tagRecoverResult[];
static const XMLCh s_tagRegisterRequest[];
static const XMLCh s_tagRegisterResult[];
+ static const XMLCh s_tagReissueKeyBinding[];
+ static const XMLCh s_tagReissueRequest[];
+ static const XMLCh s_tagReissueResult[];
static const XMLCh s_tagRepresent[];
static const XMLCh s_tagRequestId[];
static const XMLCh s_tagRequestSignatureValue[];
Modified: xml/security/trunk/c/src/xkms/XKMSMessageAbstractType.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSMessageAbstractType.hpp?rev=383302&r1=383301&r2=383302&view=diff
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSMessageAbstractType.hpp (original)
+++ xml/security/trunk/c/src/xkms/XKMSMessageAbstractType.hpp Sun Mar 5 02:20:07 2006
@@ -114,7 +114,11 @@
RegisterRequest, /** A RegisterReqeust message */
RegisterResult, /** A RegisterResult message */
RevokeRequest, /** A RevokeRequest message */
- RevokeResult /** A RevokeResult message */
+ RevokeResult, /** A RevokeResult message */
+ RecoverRequest, /** A RecoverRequest message */
+ RecoverResult, /** A RecoverResult message */
+ ReissueRequest, /** A ReissueRequest message */
+ ReissueResult, /** A ReissueResult message */
};
Modified: xml/security/trunk/c/src/xkms/XKMSMessageFactory.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSMessageFactory.hpp?rev=383302&r1=383301&r2=383302&view=diff
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSMessageFactory.hpp (original)
+++ xml/security/trunk/c/src/xkms/XKMSMessageFactory.hpp Sun Mar 5 02:20:07 2006
@@ -48,6 +48,10 @@
class XKMSRegisterResult;
class XKMSRevokeResult;
class XKMSRevokeRequest;
+class XKMSRecoverResult;
+class XKMSRecoverRequest;
+class XKMSReissueResult;
+class XKMSReissueRequest;
XSEC_DECLARE_XERCES_CLASS(DOMElement);
@@ -743,6 +747,186 @@
virtual XKMSRevokeResult * createRevokeResult(
XKMSRevokeRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
+ const XMLCh * id = NULL) = 0;
+
+ /**
+ * \brief Create a new \<RecoverRequest\> message.
+ *
+ * Generates a new RecoverRequest message from scratch, building the DOM
+ * as it goes.
+ *
+ * @param service URI
+ * @param doc Document to create the DOM structure within. The caller
+ * will need to embed the DOM structure at the appropriate place in the
+ * document (using a call to getElement to find the top level element)
+ * @param id Value to set in the Id field. If NULL, the library will
+ * generate a new Unique Id value.
+ * @returns the new XKMSRecoverRequest structure
+ */
+
+ virtual XKMSRecoverRequest * createRecoverRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ const XMLCh * id = NULL) = 0;
+
+ /**
+ * \brief Create a new \<RecoverRequest\> message and surrounding document
+ *
+ * Generates a new RecoverRequest message from scratch, building the DOM
+ * as it goes.
+ *
+ * @param service URI
+ * @param doc Will be used to return the newly created document element in.
+ * @param id Value to set in the Id field. If NULL, the library will
+ * generate a new Unique Id value.
+ * @returns the new XKMSRecoverRequest structure
+ * @note Like all the xsec library functions, the document is owned by
+ * the calling application. Deleting the RecoverRequest object will not
+ * delete the DOM document as well.
+ */
+
+ virtual XKMSRecoverRequest * createRecoverRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ const XMLCh * id = NULL) = 0;
+
+ /**
+ * \brief Create a new \<RecoverResult\> message.
+ *
+ * Generates a new RecoverResult message from scratch, building the DOM
+ * as it goes. The response will be based on a input RecoverRequest message
+ * which is used to provide Id etc.
+ *
+ * @param request Request to base response on
+ * @param doc Will be used to return the newly created document element in.
+ * @param id Value to set in the Id field. If NULL, the library will
+ * generate a new Unique Id value.
+ * @param rmaj Major result code
+ * @param rmin Minor result code
+ * @returns the new XKMSRecoverResponse structure
+ */
+
+ virtual XKMSRecoverResult * createRecoverResult(
+ XKMSRecoverRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
+ const XMLCh * id = NULL) = 0;
+
+ /**
+ * \brief Create a new \<RecoverResult\> message and surrounding document
+ *
+ * Generates a new RecoverResult message from scratch, building the DOM
+ * as it goes. The response will be based on a input RecoverRequest message
+ * which is used to provide Id etc.
+ *
+ * @param request Request to base response on
+ * @param doc Will be used to return the newly created document element in.
+ * @param id Value to set in the Id field. If NULL, the library will
+ * generate a new Unique Id value.
+ * @param rmaj Major result code
+ * @param rmin Minor result code
+ * @returns the new XKMSRecoverResponse structure
+ * @note Like all the xsec library functions, the document is owned by
+ * the calling application. Deleting the RecoverRequest object will not
+ * delete the DOM document as well.
+ */
+
+ virtual XKMSRecoverResult * createRecoverResult(
+ XKMSRecoverRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
+ const XMLCh * id = NULL) = 0;
+
+ /**
+ * \brief Create a new \<ReissueRequest\> message.
+ *
+ * Generates a new ReissueRequest message from scratch, building the DOM
+ * as it goes.
+ *
+ * @param service URI
+ * @param doc Document to create the DOM structure within. The caller
+ * will need to embed the DOM structure at the appropriate place in the
+ * document (using a call to getElement to find the top level element)
+ * @param id Value to set in the Id field. If NULL, the library will
+ * generate a new Unique Id value.
+ * @returns the new XKMSReissueRequest structure
+ */
+
+ virtual XKMSReissueRequest * createReissueRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ const XMLCh * id = NULL) = 0;
+
+ /**
+ * \brief Create a new \<ReissueRequest\> message and surrounding document
+ *
+ * Generates a new ReissueRequest message from scratch, building the DOM
+ * as it goes.
+ *
+ * @param service URI
+ * @param doc Will be used to return the newly created document element in.
+ * @param id Value to set in the Id field. If NULL, the library will
+ * generate a new Unique Id value.
+ * @returns the new XKMSReissueRequest structure
+ * @note Like all the xsec library functions, the document is owned by
+ * the calling application. Deleting the ReissueRequest object will not
+ * delete the DOM document as well.
+ */
+
+ virtual XKMSReissueRequest * createReissueRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ const XMLCh * id = NULL) = 0;
+
+ /**
+ * \brief Create a new \<ReissueResult\> message.
+ *
+ * Generates a new ReissueResult message from scratch, building the DOM
+ * as it goes. The response will be based on a input ReissueRequest message
+ * which is used to provide Id etc.
+ *
+ * @param request Request to base response on
+ * @param doc Will be used to return the newly created document element in.
+ * @param id Value to set in the Id field. If NULL, the library will
+ * generate a new Unique Id value.
+ * @param rmaj Major result code
+ * @param rmin Minor result code
+ * @returns the new XKMSReissueResponse structure
+ */
+
+ virtual XKMSReissueResult * createReissueResult(
+ XKMSReissueRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
+ const XMLCh * id = NULL) = 0;
+
+ /**
+ * \brief Create a new \<ReissueResult\> message and surrounding document
+ *
+ * Generates a new ReissueResult message from scratch, building the DOM
+ * as it goes. The response will be based on a input ReissueRequest message
+ * which is used to provide Id etc.
+ *
+ * @param request Request to base response on
+ * @param doc Will be used to return the newly created document element in.
+ * @param id Value to set in the Id field. If NULL, the library will
+ * generate a new Unique Id value.
+ * @param rmaj Major result code
+ * @param rmin Minor result code
+ * @returns the new XKMSReissueResponse structure
+ * @note Like all the xsec library functions, the document is owned by
+ * the calling application. Deleting the ReissueRequest object will not
+ * delete the DOM document as well.
+ */
+
+ virtual XKMSReissueResult * createReissueResult(
+ XKMSReissueRequest * request,
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
XKMSResultType::ResultMajor rmaj,
XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
Added: xml/security/trunk/c/src/xkms/XKMSRecoverKeyBinding.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSRecoverKeyBinding.hpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSRecoverKeyBinding.hpp (added)
+++ xml/security/trunk/c/src/xkms/XKMSRecoverKeyBinding.hpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSRecoverKeyBinding := Interface for KeyBinding elements
+ *
+ * $Id$
+ *
+ */
+
+#ifndef XKMSRECOVERKEYBINDING_INCLUDE
+#define XKMSRECOVERKEYBINDING_INCLUDE
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
+
+/**
+ * @ingroup xkms
+ */
+
+/**
+ * @brief Interface definition for the RecoverKeyBinding elements
+ *
+ * The \<RecoverKeyBinding\> Element is used in a request to Recover
+ * a particular key from an XKRS service
+ *
+ * The schema definition for RecoverKeyBinding is as follows :
+ *
+ * \verbatim
+ <!-- RecoverKeyBinding -->
+ <element name="RecoverKeyBinding" type="xkms:KeyBindingType"/>
+ <!-- /RecoverKeyBinding -->
+ \endverbatim
+ */
+
+class XKMSStatus;
+
+class XKMSRecoverKeyBinding : public XKMSKeyBindingAbstractType {
+
+ /** @name Constructors and Destructors */
+ //@{
+
+protected:
+
+ XKMSRecoverKeyBinding() {};
+
+public:
+
+ virtual ~XKMSRecoverKeyBinding() {};
+
+ //@}
+
+ /** @name Status handling */
+ //@{
+
+ /**
+ * \brief Obtain the status element for this KeyBinding
+ *
+ * The \<Status\> element is used to describe to the caller the
+ * validity of they key being described. This call is used to
+ * obtain the status element
+ *
+ * @return A pointer to the XKMSStatus element
+ */
+
+ virtual XKMSStatus * getStatus(void) const = 0;
+
+ //@}
+
+private:
+
+ // Unimplemented
+ XKMSRecoverKeyBinding(const XKMSRecoverKeyBinding &);
+ XKMSRecoverKeyBinding & operator = (const XKMSRecoverKeyBinding &);
+
+};
+
+#endif /* XKMSRECOVERKEYBINDING_INCLUDE */
Added: xml/security/trunk/c/src/xkms/XKMSRecoverRequest.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSRecoverRequest.hpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSRecoverRequest.hpp (added)
+++ xml/security/trunk/c/src/xkms/XKMSRecoverRequest.hpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSRecoverRequest := Interface for RegisterRequest Messages
+ *
+ * $Id$
+ *
+ */
+
+#ifndef XKMSRECOVERREQUEST_INCLUDE
+#define XKMSRECOVERREQUEST_INCLUDE
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xsec/xkms/XKMSRequestAbstractType.hpp>
+#include <xsec/xkms/XKMSStatus.hpp>
+
+class DSIGSignature;
+class XKMSAuthentication;
+class XKMSRecoverKeyBinding;
+
+/**
+ * @ingroup xkms
+ */
+
+/**
+ * @brief Interface definition for the RecoverRequest elements
+ *
+ * The \<RecoverRequest\> is one of the message types of
+ * the X-KRMS service. It is used when a client wishes to recover
+ * a private key known to the service.
+ *
+ * The schema definition for RecoverRequest is as follows :
+ *
+ * \verbatim
+ <!-- RecoverRequest -->
+ <element name="RecoverRequest" type="xkms:RecoverRequestType"/>
+ <complexType name="RecoverRequestType">
+ <complexContent>
+ <extension base="xkms:RequestAbstractType">
+ <sequence>
+ <element ref="xkms:RecoverKeyBinding"/>
+ <element ref="xkms:Authentication"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <element name="RecoverKeyBinding" type="xkms:KeyBindingType"/>
+ <!-- /RecoverRequest -->
+\endverbatim
+ */
+
+class XKMSRecoverRequest : public XKMSRequestAbstractType {
+
+ /** @name Constructors and Destructors */
+ //@{
+
+protected:
+
+ XKMSRecoverRequest() {};
+
+public:
+
+ virtual ~XKMSRecoverRequest() {};
+
+ /** @name Getter Interface Methods */
+ //@{
+
+ /**
+ * \brief Return the element at the base of the message
+ */
+
+ virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
+
+ /**
+ * \brief Obtain the RecoverKeyBinding element
+ *
+ * The RecoverKeyBinding element is the core of the RecoverRequest message, and
+ * defines the key information that a recover is required for.
+ *
+ * @returns A pointer to the XKMSPrototypeKeyBinding element
+ */
+
+ virtual XKMSRecoverKeyBinding * getRecoverKeyBinding(void) const = 0;
+
+ /**
+ * \brief Get the Authentication element
+ *
+ * The Authentication element of the RecoverRequest is used by the client to
+ * authenticate the request to the server.
+ *
+ * @return A pointer to the Authentication structure
+ */
+
+ virtual XKMSAuthentication * getAuthentication (void) const = 0;
+
+ //@}
+
+ /** @name Setter Interface Methods */
+ //@{
+
+ /** \brief Add a RecoverKeyBinding element
+ *
+ * Set a RecoverKeyBinding element in the Request message. The returned
+ * object can be manipulated to add KeyInfo elements to the Request.
+ *
+ * @param status The status value to add into the RecoverKeyBinding structure
+ * @returns A pointer to the newly created RecoverKeyBinding object, or
+ * the pointer to extant object if one already existed.
+ */
+
+ virtual XKMSRecoverKeyBinding * addRecoverKeyBinding(XKMSStatus::StatusValue status) = 0;
+
+ /** \brief Add an Authentication element
+ *
+ * Set a Authentication element in the Request message. The returned
+ * object can be manipulated to add Authentication information to the request.
+ *
+ * @returns A pointer to the newly created Authenticaton object, or
+ * the pointer to extant object if one already existed.
+ */
+
+ virtual XKMSAuthentication * addAuthentication(void) = 0;
+
+ //@}
+
+private:
+
+ // Unimplemented
+ XKMSRecoverRequest(const XKMSRecoverRequest &);
+ XKMSRecoverRequest & operator = (const XKMSRecoverRequest &);
+
+};
+
+#endif /* XKMSRECOVERREQUEST_INCLUDE */
Added: xml/security/trunk/c/src/xkms/XKMSRecoverResult.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSRecoverResult.hpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSRecoverResult.hpp (added)
+++ xml/security/trunk/c/src/xkms/XKMSRecoverResult.hpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSRecoverResult := Interface for RecoverResult Messages
+ *
+ * $Id$
+ *
+ */
+
+#ifndef XKMSRECOVERRESULT_INCLUDE
+#define XKMSRECOVERRESULT_INCLUDE
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xsec/xkms/XKMSResultType.hpp>
+#include <xsec/xkms/XKMSStatus.hpp>
+
+class XKMSKeyBinding;
+class XKMSUnverifiedKeyBinding;
+class XKMSRSAKeyPair;
+class XENCCipherData;
+
+/**
+ * @ingroup xkms
+ */
+
+/**
+ * @brief Interface definition for the RecoverResult elements
+ *
+ * The \<RecoverResult\> is used by the X-KRSS service to response to
+ * a user request to Recover a new key with the service.
+ *
+ * The schema definition for RecoverResult is as follows :
+ *
+ * \verbatim
+ <!-- RecoverResult -->
+ <element name="RecoverResult" type="xkms:RecoverResultType"/>
+ <complexType name="RecoverResultType">
+ <complexContent>
+ <extension base="xkms:ResultType">
+ <sequence>
+ <element ref="xkms:KeyBinding" minOccurs="0"
+ maxOccurs="unbounded"/>
+ <element ref="xkms:PrivateKey" minOccurs="0"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <!-- /RecoverResult -->
+\endverbatim
+ */
+
+class XKMSRecoverResult : public XKMSResultType {
+
+ /** @name Constructors and Destructors */
+ //@{
+
+protected:
+
+ XKMSRecoverResult() {};
+
+public:
+
+ virtual ~XKMSRecoverResult() {};
+
+ /** @name Getter Interface Methods */
+ //@{
+
+ /**
+ * \brief Return the element at the base of the message
+ */
+
+ virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
+
+ //@}
+
+ /** @name KeyBinding handling */
+ //@{
+
+ /**
+ * \brief Find number of KeyBinding elements
+ *
+ * @returns the number of KeyBinding items within the RecoverResult
+ */
+
+ virtual int getKeyBindingSize(void) const = 0;
+
+ /*
+ * \brief Obtain an KeyBinding item
+ *
+ * @param item Index of the item to return (0 = first element)
+ * @returns the KeyBinding referenced by "item"
+ */
+
+ virtual XKMSKeyBinding * getKeyBindingItem(int item) const = 0;
+
+ /*
+ * \brief Append a new KeyBinding element
+ *
+ * Allows callers to append a new KeyBinding item.
+ * The item is initially empty of KeyInfo elements - these must be added
+ * by the caller.
+ *
+ * @param status The status (Valid, Invalid or Indeterminate) of this
+ * key
+ * @returns the newly created KeyBinding object (already inserted
+ * in the RecoverResult
+ */
+
+ virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status) = 0;
+
+ //@}
+
+ /** @name PrivateKey handling */
+ //@{
+
+ /**
+ * \brief Return the RSAKeyPair
+ *
+ * This call requires the passphrase used to encrypt the private key.
+ * The implementation decrypts the PrivateKey element in the
+ * RecoverResult and returns the resulting RSAKeyPair.
+ *
+ * @note The decryption is performed *inside* the RecoverResult, so
+ * this actually modified the contents of the XML. It should never
+ * be called twice!
+ *
+ * @param passPhrase The local code page version of the pass phrase
+ * @returns the number of KeyBinding items within the RecoverResult
+ */
+
+ virtual XKMSRSAKeyPair * getRSAKeyPair(const char * passPhrase) = 0;
+
+ /**
+ * \brief Add the RSAKeyPair in an encrypted PrivateKey
+ *
+ * This call requires the passphrase to encrypt the private key.
+ * The implementation encrypts the RSAKeyPair and adds the result
+ * to the resulting RSAKey Pair. It returns the CipherData element
+ * to the caller (not a structure for the PrivateKey)
+ *
+ * @note The encryption is performed *inside* the RecoverResult, so
+ * this actually modified the contents of the XML. It should never
+ * be called twice!
+ *
+ * @param passPhrase The local code page version of the pass phrase
+ * @param Modulus Base64 encoded string with the modulus
+ * @param Exponent Base64 encoded string with the exponent
+ * @param P Base64 encoded string with p
+ * @param Q Base64 encoded string with q
+ * @param DP Base64 encoded string with dp
+ * @param DQ Base64 encoded string with dq
+ * @param InverseQ Base64 encoded string with inverseq
+ * @param D Base64 encoded string with d
+ * @param em The encryptionMethod to use for this encryption. Use
+ * ENCRYPT_NONE if a user defined type is required.
+ * @param algorithmURI If ENCRYPT_NONE is passed in, this will be
+ * used to set the algorithm URI. If this is also NULL - no
+ * EncryptionMethod will be set. <b>NULL Value Unsupported if em not
+ * set! It's use could cause problems!</b>
+ * @returns The encrypted result of adding the info
+ */
+
+ virtual XENCEncryptedData * setRSAKeyPair(const char * passPhrase,
+ XMLCh * Modulus,
+ XMLCh * Exponent,
+ XMLCh * P,
+ XMLCh * Q,
+ XMLCh * DP,
+ XMLCh * DQ,
+ XMLCh * InverseQ,
+ XMLCh * D,
+ encryptionMethod em,
+ const XMLCh * algorithmURI = NULL) = 0;
+
+ //@}
+
+
+private:
+
+ // Unimplemented
+ XKMSRecoverResult(const XKMSRecoverResult &);
+ XKMSRecoverResult & operator = (const XKMSRecoverResult &);
+
+};
+
+#endif /* XKMSRECOVERRESULT_INCLUDE */
Added: xml/security/trunk/c/src/xkms/XKMSReissueKeyBinding.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSReissueKeyBinding.hpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSReissueKeyBinding.hpp (added)
+++ xml/security/trunk/c/src/xkms/XKMSReissueKeyBinding.hpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSRevokeKeyBinding := Interface for KeyBinding elements
+ *
+ * $Id$
+ *
+ */
+
+#ifndef XKMSREISSUEKEYBINDING_INCLUDE
+#define XKMSREISSUEKEYBINDING_INCLUDE
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
+
+/**
+ * @ingroup xkms
+ */
+
+/**
+ * @brief Interface definition for the ReissueKeyBinding elements
+ *
+ * The \<ReissueKeyBinding\> Element is used in a request to reissue
+ * a particular key from an XKRS service
+ *
+ * The schema definition for ReissueKeyBinding is as follows :
+ *
+ * \verbatim
+ <!-- ReissueKeyBinding -->
+ <element name="ReissueKeyBinding" type="xkms:KeyBindingType"/>
+ <!-- /ReissueKeyBinding -->
+ \endverbatim
+ */
+
+class XKMSStatus;
+
+class XKMSReissueKeyBinding : public XKMSKeyBindingAbstractType {
+
+ /** @name Constructors and Destructors */
+ //@{
+
+protected:
+
+ XKMSReissueKeyBinding() {};
+
+public:
+
+ virtual ~XKMSReissueKeyBinding() {};
+
+ //@}
+
+ /** @name Status handling */
+ //@{
+
+ /**
+ * \brief Obtain the status element for this KeyBinding
+ *
+ * The \<Status\> element is used to describe to the caller the
+ * validity of they key being described. This call is used to
+ * obtain the status element
+ *
+ * @return A pointer to the XKMSStatus element
+ */
+
+ virtual XKMSStatus * getStatus(void) const = 0;
+
+ //@}
+
+private:
+
+ // Unimplemented
+ XKMSReissueKeyBinding(const XKMSReissueKeyBinding &);
+ XKMSReissueKeyBinding & operator = (const XKMSReissueKeyBinding &);
+
+};
+
+#endif /* XKMSREISSUEKEYBINDING_INCLUDE */
Added: xml/security/trunk/c/src/xkms/XKMSReissueRequest.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSReissueRequest.hpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSReissueRequest.hpp (added)
+++ xml/security/trunk/c/src/xkms/XKMSReissueRequest.hpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSReissueRequest := Interface for RegisterRequest Messages
+ *
+ * $Id$
+ *
+ */
+
+#ifndef XKMSREISSUEREQUEST_INCLUDE
+#define XKMSREISSUEREQUEST_INCLUDE
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xsec/xkms/XKMSRequestAbstractType.hpp>
+#include <xsec/xkms/XKMSStatus.hpp>
+
+class DSIGSignature;
+class XKMSAuthentication;
+class XKMSReissueKeyBinding;
+
+/**
+ * @ingroup xkms
+ */
+
+/**
+ * @brief Interface definition for the ReissueRequest elements
+ *
+ * The \<ReissueRequest\> is one of the message types of
+ * the X-KRMS service. It is used when a client wishes to request
+ * the service reissue a key binding (e.g. a cert).
+ *
+ * The schema definition for ReissueRequest is as follows :
+ *
+ * \verbatim
+ <!-- ReissueRequest -->
+ <element name="ReissueRequest" type="xkms:ReissueRequestType"/>
+ <complexType name="ReissueRequestType">
+ <complexContent>
+ <extension base="xkms:RequestAbstractType">
+ <sequence>
+ <element ref="xkms:ReissueKeyBinding"/>
+ <element ref="xkms:Authentication"/>
+ <element ref="xkms:ProofOfPossession" minOccurs="0"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <element name="ReissueKeyBinding" type="xkms:KeyBindingType"/>
+ <!-- /ReissueRequest -->
+\endverbatim
+ */
+
+class XKMSReissueRequest : public XKMSRequestAbstractType {
+
+ /** @name Constructors and Destructors */
+ //@{
+
+protected:
+
+ XKMSReissueRequest() {};
+
+public:
+
+ virtual ~XKMSReissueRequest() {};
+
+ /** @name Getter Interface Methods */
+ //@{
+
+ /**
+ * \brief Return the element at the base of the message
+ */
+
+ virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
+
+ /**
+ * \brief Obtain the ReissueKeyBinding element
+ *
+ * The ReissueKeyBinding element is the core of the ReissueRequest message, and
+ * defines the key information that a Reissue is required for.
+ *
+ * @returns A pointer to the XKMSPrototypeKeyBinding element
+ */
+
+ virtual XKMSReissueKeyBinding * getReissueKeyBinding(void) const = 0;
+
+ /**
+ * \brief Get the Authentication element
+ *
+ * The Authentication element of the ReissueRequest is used by the client to
+ * authenticate the request to the server.
+ *
+ * @return A pointer to the Authentication structure
+ */
+
+ virtual XKMSAuthentication * getAuthentication (void) const = 0;
+
+ /**
+ * \brief Get the signature used to prove possession of the private key
+ *
+ * When the client presents a request for a key generated by them, this element
+ * is used to show that the client is authorised to make this request using this
+ * key.
+ *
+ * @return A pointer to the proof of possession Signature object (or NULL if none
+ * was defined
+ */
+
+ virtual DSIGSignature * getProofOfPossessionSignature(void) const = 0;
+
+ //@}
+
+ /** @name Setter Interface Methods */
+ //@{
+
+ /** \brief Add a ReissueKeyBinding element
+ *
+ * Set a ReissueKeyBinding element in the Request message. The returned
+ * object can be manipulated to add KeyInfo elements to the Request.
+ *
+ * @param status The status value to add into the ReissueKeyBinding structure
+ * @returns A pointer to the newly created ReissueKeyBinding object, or
+ * the pointer to extant object if one already existed.
+ */
+
+ virtual XKMSReissueKeyBinding * addReissueKeyBinding(XKMSStatus::StatusValue status) = 0;
+
+ /** \brief Add an Authentication element
+ *
+ * Set a Authentication element in the Request message. The returned
+ * object can be manipulated to add Authentication information to the request.
+ *
+ * @returns A pointer to the newly created Authenticaton object, or
+ * the pointer to extant object if one already existed.
+ */
+
+ virtual XKMSAuthentication * addAuthentication(void) = 0;
+
+
+ /**
+ * \brief Add a ProofOfPossession signature to the message
+ *
+ * Allows the application to add a new ProofOfPossession signature into a
+ * ReissueRequest element
+ *
+ * @note the client application will need to set the key and sign the
+ * message - however the appropriate reference (to the ReissueKeyBinding
+ * element) will be set. This implies that the ReissueKeyBinding *must*
+ * be added prior to the call to this method.
+ *
+ * @returns the new Signature structure
+ */
+
+ virtual DSIGSignature * addProofOfPossessionSignature(
+ canonicalizationMethod cm = CANON_C14N_NOC,
+ signatureMethod sm = SIGNATURE_DSA,
+ hashMethod hm = HASH_SHA1) = 0;
+
+ //@}
+
+private:
+
+ // Unimplemented
+ XKMSReissueRequest(const XKMSReissueRequest &);
+ XKMSReissueRequest & operator = (const XKMSReissueRequest &);
+
+};
+
+#endif /* XKMSREISSUEREQUEST_INCLUDE */
Added: xml/security/trunk/c/src/xkms/XKMSReissueResult.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/XKMSReissueResult.hpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/XKMSReissueResult.hpp (added)
+++ xml/security/trunk/c/src/xkms/XKMSReissueResult.hpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSReissueResult := Interface for RegisterResult Messages
+ *
+ * $Id$
+ *
+ */
+
+#ifndef XKMSREISSUERESULT_INCLUDE
+#define XKMSREISSUERESULT_INCLUDE
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xsec/xkms/XKMSResultType.hpp>
+#include <xsec/xkms/XKMSStatus.hpp>
+
+class XKMSKeyBinding;
+
+/**
+ * @ingroup xkms
+ */
+
+/**
+ * @brief Interface definition for the ReissueResult elements
+ *
+ * The \<ReissueResult\> is used by the X-KRSS service to response to
+ * a user request to reissue a key from the service - e.g. for a new
+ * cert
+ *
+ * The schema definition for ReissueResult is as follows :
+ *
+ * \verbatim
+ <!-- ReissueResult -->
+ <element name="ReissueResult" type="xkms:ReissueResultType"/>
+ <complexType name="ReissueResultType">
+ <complexContent>
+ <extension base="xkms:ResultType">
+ <sequence>
+ <element ref="xkms:KeyBinding" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <!-- /ReissueResult -->
+\endverbatim
+ */
+
+class XKMSReissueResult : public XKMSResultType {
+
+ /** @name Constructors and Destructors */
+ //@{
+
+protected:
+
+ XKMSReissueResult() {};
+
+public:
+
+ virtual ~XKMSReissueResult() {};
+
+ /** @name Getter Interface Methods */
+ //@{
+
+ /**
+ * \brief Return the element at the base of the message
+ */
+
+ virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
+
+ //@}
+
+ /** @name KeyBinding handling */
+ //@{
+
+ /**
+ * \brief Find number of KeyBinding elements
+ *
+ * @returns the number of KeyBinding items within the ReissueResult
+ */
+
+ virtual int getKeyBindingSize(void) const = 0;
+
+ /*
+ * \brief Obtain an KeyBinding item
+ *
+ * @param item Index of the item to return (0 = first element)
+ * @returns the KeyBinding referenced by "item"
+ */
+
+ virtual XKMSKeyBinding * getKeyBindingItem(int item) const = 0;
+
+ /*
+ * \brief Append a new KeyBinding element
+ *
+ * Allows callers to append a new KeyBinding item.
+ * The item is initially empty of KeyInfo elements - these must be added
+ * by the caller.
+ *
+ * @param status The status (Valid, Invalid or Indeterminate) of this
+ * key
+ * @returns the newly created KeyBinding object (already inserted
+ * in the ReissueResult
+ */
+
+ virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status) = 0;
+
+ //@}
+
+private:
+
+ // Unimplemented
+ XKMSReissueResult(const XKMSReissueResult &);
+ XKMSReissueResult & operator = (const XKMSReissueResult &);
+
+};
+
+#endif /* XKMSREISSUERESULT_INCLUDE */
Modified: xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.cpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.cpp?rev=383302&r1=383301&r2=383302&view=diff
==============================================================================
--- xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.cpp (original)
+++ xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.cpp Sun Mar 5 02:20:07 2006
@@ -47,6 +47,10 @@
#include "XKMSRegisterResultImpl.hpp"
#include "XKMSRevokeResultImpl.hpp"
#include "XKMSRevokeRequestImpl.hpp"
+#include "XKMSRecoverResultImpl.hpp"
+#include "XKMSRecoverRequestImpl.hpp"
+#include "XKMSReissueResultImpl.hpp"
+#include "XKMSReissueRequestImpl.hpp"
XERCES_CPP_NAMESPACE_USE
@@ -345,6 +349,62 @@
}
+ else if (strEquals(name, XKMSConstants::s_tagRecoverRequest)) {
+
+ // This is a <RevokeRequest> message
+ XKMSRecoverRequestImpl * ret;
+ XSECnew(ret, XKMSRecoverRequestImpl(env, elt));
+ Janitor<XKMSRecoverRequestImpl> j_ret(ret);
+
+ ret->load();
+
+ j_ret.release();
+ return (XKMSRecoverRequest *) ret;
+
+ }
+
+ else if (strEquals(name, XKMSConstants::s_tagRecoverResult)) {
+
+ // This is a <RecoverResult> message
+ XKMSRecoverResultImpl * ret;
+ XSECnew(ret, XKMSRecoverResultImpl(env, elt));
+ Janitor<XKMSRecoverResultImpl> j_ret(ret);
+
+ ret->load();
+
+ j_ret.release();
+ return (XKMSRecoverResult *) ret;
+
+ }
+
+ else if (strEquals(name, XKMSConstants::s_tagReissueRequest)) {
+
+ // This is a <ReissueRequest> message
+ XKMSReissueRequestImpl * ret;
+ XSECnew(ret, XKMSReissueRequestImpl(env, elt));
+ Janitor<XKMSReissueRequestImpl> j_ret(ret);
+
+ ret->load();
+
+ j_ret.release();
+ return (XKMSReissueRequest *) ret;
+
+ }
+
+ else if (strEquals(name, XKMSConstants::s_tagReissueResult)) {
+
+ // This is a <RevokeResult> message
+ XKMSReissueResultImpl * ret;
+ XSECnew(ret, XKMSReissueResultImpl(env, elt));
+ Janitor<XKMSReissueResultImpl> j_ret(ret);
+
+ ret->load();
+
+ j_ret.release();
+ return (XKMSReissueResult *) ret;
+
+ }
+
delete env;
return NULL;
@@ -631,6 +691,86 @@
return rri;
}
+XKMSRecoverRequest * XKMSMessageFactoryImpl::createRecoverRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ const XMLCh * id) {
+
+ XKMSRecoverRequestImpl * rri;
+
+ XSECEnv * tenv;
+ XSECnew(tenv, XSECEnv(*mp_env));
+ tenv->setParentDocument(doc);
+
+ XSECnew(rri, XKMSRecoverRequestImpl(tenv));
+ rri->createBlankRecoverRequest(service, id);
+
+ return rri;
+
+}
+
+
+XKMSRecoverRequest * XKMSMessageFactoryImpl::createRecoverRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ const XMLCh * id) {
+
+
+ // Create a document to put the element in
+
+ XMLCh tempStr[100];
+ XMLString::transcode("Core", tempStr, 99);
+ DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
+
+ *doc = impl->createDocument();
+
+ // Embed the new structure in the document
+ XKMSRecoverRequest * rri = createRecoverRequest(service, *doc, id);
+ (*doc)->appendChild(rri->getElement());
+
+ return rri;
+}
+
+XKMSReissueRequest * XKMSMessageFactoryImpl::createReissueRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ const XMLCh * id) {
+
+ XKMSReissueRequestImpl * rri;
+
+ XSECEnv * tenv;
+ XSECnew(tenv, XSECEnv(*mp_env));
+ tenv->setParentDocument(doc);
+
+ XSECnew(rri, XKMSReissueRequestImpl(tenv));
+ rri->createBlankReissueRequest(service, id);
+
+ return rri;
+
+}
+
+
+XKMSReissueRequest * XKMSMessageFactoryImpl::createReissueRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ const XMLCh * id) {
+
+
+ // Create a document to put the element in
+
+ XMLCh tempStr[100];
+ XMLString::transcode("Core", tempStr, 99);
+ DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
+
+ *doc = impl->createDocument();
+
+ // Embed the new structure in the document
+ XKMSReissueRequest * rri = createReissueRequest(service, *doc, id);
+ (*doc)->appendChild(rri->getElement());
+
+ return rri;
+}
+
// --------------------------------------------------------------------------------
// Create a result based on a request
// --------------------------------------------------------------------------------
@@ -918,10 +1058,11 @@
copyRequestToResult(request, (XKMSResultTypeImpl*) rri);
- return rri;
+ return rri;
}
+
XKMSRevokeResult * XKMSMessageFactoryImpl::createRevokeResult(
XKMSRevokeRequest * request,
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
@@ -944,6 +1085,94 @@
return rr;
}
+XKMSReissueResult * XKMSMessageFactoryImpl::createReissueResult(
+ XKMSReissueRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin,
+ const XMLCh * id) {
+
+ XKMSReissueResultImpl * rri;
+
+ XSECEnv * tenv;
+ XSECnew(tenv, XSECEnv(*mp_env));
+ tenv->setParentDocument(doc);
+
+ XSECnew(rri, XKMSReissueResultImpl(tenv));
+ rri->createBlankReissueResult(request->getService(), id, rmaj, rmin);
+
+ copyRequestToResult(request, (XKMSResultTypeImpl*) rri);
+
+ return rri;
+
+}
+
+XKMSReissueResult * XKMSMessageFactoryImpl::createReissueResult(
+ XKMSReissueRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin,
+ const XMLCh * id) {
+
+ // Create a document to put the element in
+
+ XMLCh tempStr[100];
+ XMLString::transcode("Core", tempStr, 99);
+ DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
+
+ *doc = impl->createDocument();
+
+ // Embed the new structure in the document
+ XKMSReissueResult * rr = createReissueResult(request, *doc, rmaj, rmin, id);
+ (*doc)->appendChild(rr->getElement());
+
+ return rr;
+}
+
+XKMSRecoverResult * XKMSMessageFactoryImpl::createRecoverResult(
+ XKMSRecoverRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin,
+ const XMLCh * id) {
+
+ XKMSRecoverResultImpl * rri;
+
+ XSECEnv * tenv;
+ XSECnew(tenv, XSECEnv(*mp_env));
+ tenv->setParentDocument(doc);
+
+ XSECnew(rri, XKMSRecoverResultImpl(tenv));
+ rri->createBlankRecoverResult(request->getService(), id, rmaj, rmin);
+
+ copyRequestToResult(request, (XKMSResultTypeImpl*) rri);
+
+ return rri;
+
+}
+
+XKMSRecoverResult * XKMSMessageFactoryImpl::createRecoverResult(
+ XKMSRecoverRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin,
+ const XMLCh * id) {
+
+ // Create a document to put the element in
+
+ XMLCh tempStr[100];
+ XMLString::transcode("Core", tempStr, 99);
+ DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
+
+ *doc = impl->createDocument();
+
+ // Embed the new structure in the document
+ XKMSRecoverResult * rr = createRecoverResult(request, *doc, rmaj, rmin, id);
+ (*doc)->appendChild(rr->getElement());
+
+ return rr;
+}
+
// --------------------------------------------------------------------------------
// Message Conversions
// --------------------------------------------------------------------------------
@@ -960,6 +1189,8 @@
case XKMSMessageAbstractType::PendingRequest :
case XKMSMessageAbstractType::RegisterRequest :
case XKMSMessageAbstractType::RevokeRequest :
+ case XKMSMessageAbstractType::RecoverRequest :
+ case XKMSMessageAbstractType::ReissueRequest :
case XKMSMessageAbstractType::StatusRequest :
return (XKMSRequestAbstractType *) msg;
@@ -982,6 +1213,8 @@
case XKMSMessageAbstractType::CompoundResult :
case XKMSMessageAbstractType::RegisterResult :
case XKMSMessageAbstractType::RevokeResult :
+ case XKMSMessageAbstractType::RecoverResult :
+ case XKMSMessageAbstractType::ReissueResult :
case XKMSMessageAbstractType::StatusResult :
case XKMSMessageAbstractType::Result :
Modified: xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.hpp?rev=383302&r1=383301&r2=383302&view=diff
==============================================================================
--- xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.hpp (original)
+++ xml/security/trunk/c/src/xkms/impl/XKMSMessageFactoryImpl.hpp Sun Mar 5 02:20:07 2006
@@ -202,6 +202,50 @@
XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
const XMLCh * id = NULL);
+ virtual XKMSRecoverRequest * createRecoverRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ const XMLCh * id = NULL);
+ virtual XKMSRecoverRequest * createRecoverRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ const XMLCh * id = NULL);
+
+ virtual XKMSRecoverResult * createRecoverResult(
+ XKMSRecoverRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
+ const XMLCh * id = NULL);
+ virtual XKMSRecoverResult * createRecoverResult(
+ XKMSRecoverRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
+ const XMLCh * id = NULL);
+
+ virtual XKMSReissueRequest * createReissueRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ const XMLCh * id = NULL);
+ virtual XKMSReissueRequest * createReissueRequest(
+ const XMLCh * service,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ const XMLCh * id = NULL);
+
+ virtual XKMSReissueResult * createReissueResult(
+ XKMSReissueRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
+ const XMLCh * id = NULL);
+ virtual XKMSReissueResult * createReissueResult(
+ XKMSReissueRequest * request,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
+ XKMSResultType::ResultMajor rmaj,
+ XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
+ const XMLCh * id = NULL);
+
/* Conversions */
virtual XKMSRequestAbstractType * toRequestAbstractType(XKMSMessageAbstractType *msg);
virtual XKMSResultType * toResultType(XKMSMessageAbstractType *msg);
Added: xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.cpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.cpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.cpp (added)
+++ xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.cpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSRecoverKeyBindingImpl := Implementation for RecoverKeyBinding
+ *
+ * $Id$
+ *
+ */
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xsec/framework/XSECError.hpp>
+#include <xsec/framework/XSECEnv.hpp>
+#include <xsec/xkms/XKMSConstants.hpp>
+
+#include <xercesc/dom/DOM.hpp>
+
+#include "XKMSRecoverKeyBindingImpl.hpp"
+#include "XKMSStatusImpl.hpp"
+
+XERCES_CPP_NAMESPACE_USE
+
+// --------------------------------------------------------------------------------
+// Construct/Destruct
+// --------------------------------------------------------------------------------
+
+XKMSRecoverKeyBindingImpl::XKMSRecoverKeyBindingImpl(
+ const XSECEnv * env
+ ) :
+XKMSKeyBindingAbstractTypeImpl(env) {
+ mp_status = NULL;
+}
+
+XKMSRecoverKeyBindingImpl::XKMSRecoverKeyBindingImpl(
+ const XSECEnv * env,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
+ ) :
+XKMSKeyBindingAbstractTypeImpl(env, node) {
+
+ mp_status = NULL;
+}
+
+XKMSRecoverKeyBindingImpl::~XKMSRecoverKeyBindingImpl() {
+
+ if (mp_status != NULL)
+ delete mp_status;
+
+}
+
+// --------------------------------------------------------------------------------
+// Load from DOM
+// --------------------------------------------------------------------------------
+
+void XKMSRecoverKeyBindingImpl::load(void) {
+
+ if (mp_keyBindingAbstractTypeElement == NULL) {
+ throw XSECException(XSECException::ExpectedXKMSChildNotFound,
+ "XKMSRecoverKeyBindingImpl::load - called on empty DOM");
+ }
+
+ XKMSKeyBindingAbstractTypeImpl::load();
+
+ /* Find the status element */
+ DOMNodeList * nl = mp_keyBindingAbstractTypeElement->getElementsByTagNameNS(
+ XKMSConstants::s_unicodeStrURIXKMS,
+ XKMSConstants::s_tagStatus);
+
+ if (nl == NULL || nl->getLength() != 1) {
+ throw XSECException(XSECException::ExpectedXKMSChildNotFound,
+ "XKMSRecoverKeyBinding::load - Status value not found");
+ }
+
+ XSECnew(mp_status, XKMSStatusImpl(mp_env, (DOMElement*) nl->item(0)));
+ mp_status->load();
+
+}
+
+// --------------------------------------------------------------------------------
+// Create
+// --------------------------------------------------------------------------------
+
+DOMElement * XKMSRecoverKeyBindingImpl::createBlankRecoverKeyBinding(XKMSStatus::StatusValue status) {
+
+ DOMElement * ret = XKMSKeyBindingAbstractTypeImpl::
+ createBlankKeyBindingAbstractType(XKMSConstants::s_tagRecoverKeyBinding);
+
+ mp_env->doPrettyPrint(ret);
+
+ // Create the status element
+ XSECnew(mp_status, XKMSStatusImpl(mp_env));
+ ret->appendChild(mp_status->createBlankStatus(status));
+ mp_env->doPrettyPrint(ret);
+
+ return ret;
+
+}
+
+// --------------------------------------------------------------------------------
+// Status handling
+// --------------------------------------------------------------------------------
+
+XKMSStatus * XKMSRecoverKeyBindingImpl::getStatus(void) const {
+
+ return mp_status;
+
+}
+
Added: xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.hpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.hpp (added)
+++ xml/security/trunk/c/src/xkms/impl/XKMSRecoverKeyBindingImpl.hpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSRecoverKeyBinding := Implementation for RecoverKeyBinding
+ *
+ * $Id$
+ *
+ */
+
+#ifndef XKMSRECOVERKEYBINDINGIMPL_INCLUDE
+#define XKMSRECOVERKEYBINDINGIMPL_INCLUDE
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xsec/xkms/XKMSRecoverKeyBinding.hpp>
+#include <xsec/xkms/XKMSStatus.hpp>
+
+#include "XKMSKeyBindingAbstractTypeImpl.hpp"
+
+class XKMSStatusImpl;
+
+class XKMSRecoverKeyBindingImpl : public XKMSRecoverKeyBinding, public XKMSKeyBindingAbstractTypeImpl {
+
+public:
+
+ XKMSRecoverKeyBindingImpl(
+ const XSECEnv * env
+ );
+
+ XKMSRecoverKeyBindingImpl(
+ const XSECEnv * env,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
+ );
+
+ virtual ~XKMSRecoverKeyBindingImpl() ;
+
+ // Load
+ void load(void);
+
+ // Create
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
+ createBlankRecoverKeyBinding(XKMSStatus::StatusValue status);
+
+ // Interface
+ virtual XKMSStatus * getStatus(void) const;
+
+ // Import methods from XKMSKeyBindingAbstractType
+ XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS
+
+private:
+
+ XKMSStatusImpl * mp_status;
+
+ // Unimplemented
+ XKMSRecoverKeyBindingImpl(void);
+ XKMSRecoverKeyBindingImpl(const XKMSRecoverKeyBindingImpl &);
+ XKMSRecoverKeyBindingImpl & operator = (const XKMSRecoverKeyBindingImpl &);
+
+};
+
+#endif /* XKMSRECOVERKEYBINDINGIMPL_INCLUDE */
Added: xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.cpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.cpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.cpp (added)
+++ xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.cpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,255 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSRecoverRequestImpl := Implementation for RegisterRequest Messages
+ *
+ * $Id$
+ *
+ */
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+
+#include <xsec/dsig/DSIGReference.hpp>
+#include <xsec/framework/XSECEnv.hpp>
+#include <xsec/framework/XSECError.hpp>
+#include <xsec/utils/XSECDOMUtils.hpp>
+#include <xsec/xkms/XKMSConstants.hpp>
+#include <xsec/xkms/XKMSStatus.hpp>
+
+#include "XKMSRecoverRequestImpl.hpp"
+#include "XKMSRecoverKeyBindingImpl.hpp"
+#include "XKMSAuthenticationImpl.hpp"
+
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/util/XMLUniDefs.hpp>
+
+XERCES_CPP_NAMESPACE_USE
+
+// --------------------------------------------------------------------------------
+// Construct/Destruct
+// --------------------------------------------------------------------------------
+
+XKMSRecoverRequestImpl::XKMSRecoverRequestImpl(const XSECEnv * env) :
+m_request(env),
+m_msg(m_request.m_msg),
+mp_authentication(NULL),
+mp_recoverKeyBinding(NULL) {
+}
+
+XKMSRecoverRequestImpl::XKMSRecoverRequestImpl(const XSECEnv * env, DOMElement * node) :
+m_request(env, node),
+m_msg(m_request.m_msg),
+mp_authentication(NULL),
+mp_recoverKeyBinding(NULL) {
+}
+
+XKMSRecoverRequestImpl::~XKMSRecoverRequestImpl() {
+
+ if (mp_authentication != NULL)
+ delete mp_authentication;
+ if (mp_recoverKeyBinding != NULL)
+ delete mp_recoverKeyBinding;
+
+}
+
+// --------------------------------------------------------------------------------
+// Load
+// --------------------------------------------------------------------------------
+
+void XKMSRecoverRequestImpl::load(void) {
+
+ if (m_msg.mp_messageAbstractTypeElement == NULL) {
+
+ // Attempt to load an empty element
+ throw XSECException(XSECException::XKMSError,
+ "XKMSRecoverRequest::load - called on empty DOM");
+
+ }
+
+ if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
+ XKMSConstants::s_tagRecoverRequest)) {
+
+ throw XSECException(XSECException::XKMSError,
+ "XKMSRecoverRequest::load - called on incorrect node");
+
+ }
+
+ // Load the base message
+ m_request.load();
+
+ // Now check for any RecoverKeyBinding elements
+ DOMElement * tmpElt = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
+ while (tmpElt != NULL && !strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagRecoverKeyBinding)) {
+ tmpElt = findNextElementChild(tmpElt);
+ }
+
+ if (tmpElt != NULL) {
+
+ XSECnew(mp_recoverKeyBinding, XKMSRecoverKeyBindingImpl(m_msg.mp_env, tmpElt));
+ mp_recoverKeyBinding->load();
+
+ tmpElt = findNextElementChild(tmpElt);
+
+ }
+ else {
+
+ throw XSECException(XSECException::ExpectedXKMSChildNotFound,
+ "XKMSRecoverRequest::load - Expected RecoverKeyBinding node");
+
+ }
+
+ // Authentication Element
+
+ if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagAuthentication)) {
+
+ XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env, tmpElt));
+ mp_authentication->load(mp_recoverKeyBinding->getId());
+
+ }
+ else {
+
+ throw XSECException(XSECException::ExpectedXKMSChildNotFound,
+ "XKMSRecoverRequest::load - Expected Authentication node");
+
+ }
+
+}
+
+
+// --------------------------------------------------------------------------------
+// Create
+// --------------------------------------------------------------------------------
+
+DOMElement * XKMSRecoverRequestImpl::
+ createBlankRecoverRequest(const XMLCh * service, const XMLCh * id) {
+
+ return m_request.createBlankRequestAbstractType(
+ XKMSConstants::s_tagRecoverRequest, service, id);
+
+}
+
+// --------------------------------------------------------------------------------
+// MessageType
+// --------------------------------------------------------------------------------
+
+XKMSMessageAbstractType::messageType XKMSRecoverRequestImpl::getMessageType(void) {
+
+ return XKMSMessageAbstractTypeImpl::RecoverRequest;
+
+}
+
+// --------------------------------------------------------------------------------
+// Get Methods
+// --------------------------------------------------------------------------------
+
+XKMSRecoverKeyBinding * XKMSRecoverRequestImpl::getRecoverKeyBinding(void) const {
+
+ return mp_recoverKeyBinding;
+
+}
+
+XKMSAuthentication * XKMSRecoverRequestImpl::getAuthentication (void) const {
+
+ return mp_authentication;
+
+}
+
+// --------------------------------------------------------------------------------
+// Set Methods
+// --------------------------------------------------------------------------------
+
+XKMSRecoverKeyBinding * XKMSRecoverRequestImpl::addRecoverKeyBinding(XKMSStatus::StatusValue status) {
+
+ if (mp_recoverKeyBinding != NULL)
+ return mp_recoverKeyBinding;
+
+
+ // OK - Nothing exists, so we need to create from scratch
+
+ XSECnew(mp_recoverKeyBinding, XKMSRecoverKeyBindingImpl(m_msg.mp_env));
+ DOMElement * elt = mp_recoverKeyBinding->createBlankRecoverKeyBinding(status);
+
+ // Insert
+
+ DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
+
+ while (be != NULL &&
+ !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagAuthentication) &&
+ !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagRevocationCode)) {
+ be = findNextElementChild(be);
+ }
+
+ if (be == NULL) {
+ m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
+ m_msg.mp_messageAbstractTypeElement->appendChild(elt);
+ m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
+ return mp_recoverKeyBinding;
+ }
+
+ m_msg.mp_messageAbstractTypeElement->insertBefore(elt, be);
+ if (m_msg.mp_env->getPrettyPrintFlag() == true) {
+ m_msg.mp_messageAbstractTypeElement->insertBefore(
+ m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
+ be);
+ }
+
+ return mp_recoverKeyBinding;
+
+}
+
+XKMSAuthentication * XKMSRecoverRequestImpl::addAuthentication(void) {
+
+ if (mp_authentication != NULL)
+ return mp_authentication;
+
+ if (mp_recoverKeyBinding == NULL) {
+ throw XSECException(XSECException::XKMSError,
+ "XKMSRecoverRequestImpl::addAuthentication - called prior to key infos being added");
+ }
+
+ XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env));
+ DOMElement * e =
+ mp_authentication->createBlankAuthentication(mp_recoverKeyBinding->getId());
+
+ DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
+
+ while (be != NULL && !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagRevocationCode))
+ be = findNextElementChild(be);
+
+ if (be == NULL) {
+ m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
+ m_msg.mp_messageAbstractTypeElement->appendChild(e);
+ m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
+ return mp_authentication;
+ }
+
+ m_msg.mp_messageAbstractTypeElement->insertBefore(e, be);
+ if (m_msg.mp_env->getPrettyPrintFlag() == true) {
+ m_msg.mp_messageAbstractTypeElement->insertBefore(
+ m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
+ be);
+ }
+
+ return mp_authentication;
+
+}
+
+
Added: xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.hpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.hpp?rev=383302&view=auto
==============================================================================
--- xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.hpp (added)
+++ xml/security/trunk/c/src/xkms/impl/XKMSRecoverRequestImpl.hpp Sun Mar 5 02:20:07 2006
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * XSEC
+ *
+ * XKMSRecoverRequestImpl := Implementation for RecoverRequest Messages
+ *
+ * $Id$
+ *
+ */
+
+#ifndef XKMSRECOVERREQUESTIMPL_INCLUDE
+#define XKMSRECOVERREQUESTIMPL_INCLUDE
+
+// XSEC Includes
+
+#include <xsec/framework/XSECDefs.hpp>
+#include <xsec/xkms/XKMSRecoverRequest.hpp>
+#include "XKMSRequestAbstractTypeImpl.hpp"
+
+class XKMSAuthenticationImpl;
+class DSIGSignature;
+class XKMSRecoverKeyBindingImpl;
+
+class XKMSRecoverRequestImpl : public XKMSRecoverRequest {
+
+public:
+ XKMSRequestAbstractTypeImpl m_request;
+ XKMSMessageAbstractTypeImpl &m_msg;
+public:
+
+ XKMSRecoverRequestImpl(
+ const XSECEnv * env
+ );
+
+ XKMSRecoverRequestImpl(
+ const XSECEnv * env,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
+ );
+
+ virtual ~XKMSRecoverRequestImpl();
+
+ // Load elements
+ void load();
+
+ // Creation
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
+ createBlankRecoverRequest(
+ const XMLCh * service,
+ const XMLCh * id = NULL);
+
+
+ /* Getter Interface Methods */
+ virtual XKMSRecoverKeyBinding * getRecoverKeyBinding(void) const;
+ virtual XKMSAuthentication * getAuthentication (void) const;
+
+ /* Setter Interface Methods */
+
+ virtual XKMSRecoverKeyBinding * addRecoverKeyBinding(XKMSStatus::StatusValue status);
+ virtual XKMSAuthentication * addAuthentication(void);
+
+ /* Implemented from MessageAbstractType */
+ virtual messageType getMessageType(void);
+
+ /* Forced inheritance from XKMSMessageAbstractTypeImpl */
+ XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
+
+ /* Forced inheritance from RequestAbstractType */
+ XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
+
+
+private:
+
+ XKMSAuthenticationImpl * mp_authentication;
+ XKMSRecoverKeyBindingImpl * mp_recoverKeyBinding;
+
+ XSECProvider m_prov; // For creating the signature
+
+ // Unimplemented
+ XKMSRecoverRequestImpl(void);
+ XKMSRecoverRequestImpl(const XKMSRecoverRequestImpl &);
+ XKMSRecoverRequestImpl & operator = (const XKMSRecoverRequestImpl &);
+
+};
+
+#endif /* XKMSRECOVERREQUESTIMPL_INCLUDE */
+