Skip to Content.
Sympa Menu

mace-opensaml-users - SAML request signature in C++ and Java

Subject: OpenSAML user discussion

List archive

SAML request signature in C++ and Java


Chronological Thread 
  • From: Gabriel López <>
  • To:
  • Subject: SAML request signature in C++ and Java
  • Date: Thu, 20 May 2004 17:23:38 +0200



Hi all.

I am trying to generate a SAMLRequest in OpenSAML C++ (cvs version) and send it to a servlet Java (using OpenSAML 0.9.1) to be verified.
I can build the SAMLRequest message and sign it with the following code:

SAMLNameIdentifier* nameid = new SAMLNameIdentifier(handle.get(),domain.get());
SAMLSubject* subject = new SAMLSubject(nameid);
SAMLAttributeQuery* attquery = new SAMLAttributeQuery(subject,resource.get());
SAMLRequest* req=new SAMLRequest(Iterator<saml::QName>(),attquery);
// read private key
BIO *bio=BIO_new(BIO_s_file());
BIO_read_filename(bio,key);
EVP_PKEY* pkey=PEM_read_bio_PrivateKey(bio,NULL,NULL,NULL);
OpenSSLCryptoKeyRSA* xseckey=new OpenSSLCryptoKeyRSA(pkey);
// read certificate
BIO *bio2=BIO_new(BIO_s_file());
BIO_read_filename(bio2,cert);
X509* x50=PEM_read_bio_X509(bio2,NULL,0,NULL);
auto_ptr<OpenSSLCryptoX509> x509(new OpenSSLCryptoX509(x50)); XSECCryptoX509* certs[] = { x509.get() };
// sign request
req->sign(SIGNATURE_RSA,xseckey->clone(),ArrayIterator<XSECCryptoX509*>(certs,1));
delete xseckey;
EVP_PKEY_free(pkey);
cout << *req;
// send request
SAMLBinding* pBinding= new SAMLSOAPBinding();
SAMLResponse* resp=pBinding->send(binfo,*req);
delete pBinding;

Now I receive the request in the servlet as follow:

public void doPost(HttpServletRequest peticion, HttpServletResponse respuesta) throws IOException, ServletException {
StringBuffer buf = new StringBuffer();
try {
SAMLSOAPBinding soapBinding= new SAMLSOAPBinding(); SAMLRequest request = soapBinding.receive(peticion,buf); request.verify(); System.out.println("request verify done ");
......

But the message "request verify done" is never displayed and no Exception is launched.

Any idea?
thanks, Gabi.







Archive powered by MHonArc 2.6.16.

Top of Page