Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 29424 invoked from network); 15 Feb 2007 06:17:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Feb 2007 06:17:11 -0000 Received: (qmail 60954 invoked by uid 500); 15 Feb 2007 06:17:18 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 60835 invoked by uid 500); 15 Feb 2007 06:17:18 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 60824 invoked by uid 500); 15 Feb 2007 06:17:18 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 60821 invoked by uid 99); 15 Feb 2007 06:17:18 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Feb 2007 22:17:18 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Feb 2007 22:17:08 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id AAD411A981A; Wed, 14 Feb 2007 22:16:48 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r507829 - in /webservices/axis2/trunk/c/rampart: include/openssl_sign.h src/omxmlsec/openssl/Makefile.am src/omxmlsec/openssl/sign.c Date: Thu, 15 Feb 2007 06:16:48 -0000 To: axis2-cvs@ws.apache.org From: kaushalye@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070215061648.AAD411A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kaushalye Date: Wed Feb 14 22:16:47 2007 New Revision: 507829 URL: http://svn.apache.org/viewvc?view=rev&rev=507829 Log: Adding signature wrappers for openssl layer in OMXMLSecurity Added: webservices/axis2/trunk/c/rampart/include/openssl_sign.h webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am Added: webservices/axis2/trunk/c/rampart/include/openssl_sign.h URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_sign.h?view=auto&rev=507829 ============================================================================== --- webservices/axis2/trunk/c/rampart/include/openssl_sign.h (added) +++ webservices/axis2/trunk/c/rampart/include/openssl_sign.h Wed Feb 14 22:16:47 2007 @@ -0,0 +1,51 @@ +/* + * Copyright 2003-2004 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. + */ + +#include +#include +#include +#include +#include + +/** + * @file openssl_sign.h + * @brief + */ +#ifndef OPENSSL_SIGN_H +#define OPENSSL_SIGN_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup + * @ingroup + * @{ + */ + +AXIS2_EXTERN int AXIS2_CALL +openssl_sign(const axis2_env_t *env, + oxs_sign_ctx_t *sign_ctx, + oxs_buffer_t *input_buf, + oxs_buffer_t *output_buf); + + +/** @} */ +#ifdef __cplusplus +} +#endif + +#endif /* OPENSSL_SIGN_H */ Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am?view=diff&rev=507829&r1=507828&r2=507829 ============================================================================== --- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am (original) +++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am Wed Feb 14 22:16:47 2007 @@ -1,5 +1,5 @@ noinst_LTLIBRARIES = libomopenssl.la -libomopenssl_la_SOURCES = cipher_ctx.c crypt.c rsa.c pkey.c util.c cipher_property.c digest.c x509.c pkcs12.c pem.c +libomopenssl_la_SOURCES = cipher_ctx.c crypt.c rsa.c pkey.c util.c cipher_property.c digest.c x509.c pkcs12.c pem.c sign.c libomopenssl_la_LIBADD = -lssl\ ../../../../util/src/libaxis2_util.la \ Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c?view=auto&rev=507829 ============================================================================== --- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c (added) +++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c Wed Feb 14 22:16:47 2007 @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BUFSIZE 64 +AXIS2_EXTERN int AXIS2_CALL +openssl_sign(const axis2_env_t *env, + oxs_sign_ctx_t *sign_ctx, + oxs_buffer_t *input_buf, + oxs_buffer_t *output_buf) +{ + openssl_pkey_t *open_pkey = NULL; + unsigned char sig_buf[4096]; /*Allocate enough memory dynamically*/ + unsigned int sig_len; + const EVP_MD* digest; + EVP_MD_CTX md_ctx; + EVP_PKEY* pkey; + int err, ret; + /*Get the key*/ + open_pkey = oxs_sign_ctx_get_private_key(sign_ctx, env); + pkey = OPENSSL_PKEY_GET_KEY(open_pkey, env); + + /*Set the digest according to the signature method*/ + digest = EVP_sha1(); + /*Sign init*/ + + ret = EVP_SignInit(&md_ctx, digest); + + EVP_SignUpdate (&md_ctx, OXS_BUFFER_GET_DATA(input_buf, env), OXS_BUFFER_GET_SIZE(input_buf, env)); + sig_len = sizeof(sig_buf); + err = EVP_SignFinal (&md_ctx, + sig_buf, + &sig_len, + pkey); + if (err != 1) { + ERR_print_errors_fp (stderr); + } + /*Fill the output buffer*/ + output_buf = oxs_buffer_create(env); + OXS_BUFFER_POPULATE(output_buf, env, sig_buf, sig_len); + + return sig_len; +} + --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org