directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r731344 - /directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
Date Sun, 04 Jan 2009 19:39:17 GMT
Author: kayyagari
Date: Sun Jan  4 11:39:16 2009
New Revision: 731344

URL: http://svn.apache.org/viewvc?rev=731344&view=rev
Log:
added payload decoding

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java?rev=731344&r1=731343&r2=731344&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
Sun Jan  4 11:39:16 2009
@@ -20,6 +20,7 @@
 package org.apache.directory.server.ldap.handlers.extended;
 
 
+import java.nio.ByteBuffer;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
@@ -29,6 +30,11 @@
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
 import org.apache.directory.server.ldap.LdapService;
 import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.ldap.codec.extended.operations.CertGenerationContainer;
+import org.apache.directory.shared.ldap.codec.extended.operations.CertGenerationDecoder;
+import org.apache.directory.shared.ldap.codec.extended.operations.CertGenerationObject;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;
 import org.apache.directory.shared.ldap.message.extended.CertGenerationRequest;
 import org.apache.directory.shared.ldap.message.extended.CertGenerationResponse;
@@ -74,12 +80,25 @@
 
     public void handleExtendedOperation( LdapSession session, ExtendedRequest req ) throws
Exception
     {
-        CertGenerationRequest certGenReq = ( CertGenerationRequest ) req;
+        ByteBuffer bb = ByteBuffer.wrap( req.getPayload() );
+        Asn1Decoder decoder = new CertGenerationDecoder();
+        CertGenerationContainer container = new CertGenerationContainer();
         
-        ClonedServerEntry entry = session.getCoreSession().lookup( new LdapDN( certGenReq.getTargetDN()
) );
+        try
+        {
+            decoder.decode( bb, container );
+        }
+        catch( DecoderException e )
+        {
+            throw e;
+        }
+        
+        CertGenerationObject certGenObj = container.getCertGenerationObject();
+        
+        ClonedServerEntry entry = session.getCoreSession().lookup( new LdapDN( certGenObj.getTargetDN()
) );
         if( entry != null )
         {
-            TlsKeyGenerator.addKeyPair( entry.getOriginalEntry(), certGenReq.getIssuerDN(),
certGenReq.getSubjectDN(), certGenReq.getKeyAlgorithm() );
+            TlsKeyGenerator.addKeyPair( entry.getOriginalEntry(), certGenObj.getIssuerDN(),
certGenObj.getSubjectDN(), certGenObj.getKeyAlgorithm() );
         }
     }
 



Mime
View raw message