SIGN: replace tab to space characters 74/11874/2
authorJihoon Song <jihoon80.song@samsung.com>
Thu, 7 Nov 2013 05:12:40 +0000 (14:12 +0900)
committerJihoon Song <jihoon80.song@samsung.com>
Thu, 7 Nov 2013 06:43:23 +0000 (15:43 +0900)
Change-Id: I2594860adcc11cf556293b145c8ece591219d232
Signed-off-by: Jihoon Song <jihoon80.song@samsung.com>
org.tizen.common.sign/src/org/apache/xml/security/signature/Reference.java
org.tizen.common.sign/src/org/apache/xml/security/signature/XMLSignature.java

index 86b1ea7..cb053ab 100644 (file)
@@ -18,7 +18,6 @@
  */
 package org.apache.xml.security.signature;
 
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.FileInputStream;
@@ -340,11 +339,11 @@ public class Reference extends SignatureElementProxy {
     }
     
     private void setDigestValueBase64Encoded(String value) {
-       this.digestValueBase64Encoded = value;
+        this.digestValueBase64Encoded = value;
     }
    
     public String getDigestValueBase64Encoded() {
-       return this.digestValueBase64Encoded;
+        return this.digestValueBase64Encoded;
     }
 
     /**
@@ -426,11 +425,11 @@ public class Reference extends SignatureElementProxy {
     }
 
     /*
-     * 정성근 선임에 의해 추가되었다.
+     * INFO: this is added by sunggun.jung
      */
     public void generateDigestValue(String targetValue)
         throws XMLSignatureException, ReferenceNotInitializedException {
-               this.setDigestValueElement(targetValue);
+           this.setDigestValueElement(targetValue);
     }
     
 
@@ -724,7 +723,7 @@ public class Reference extends SignatureElementProxy {
             mda.reset();
             DigesterOutputStream diOs = new DigesterOutputStream(mda);
             os = new UnsyncBufferedOutputStream(diOs);
-            XMLSignatureInput output = this.dereferenceURIandPerformTransforms(os);         
+            XMLSignatureInput output = this.dereferenceURIandPerformTransforms(os);
             // if signing and c14n11 property == true explicitly add
             // C14N11 transform if needed
             if (Reference.useC14N11 && !validating && !output.isOutputStreamSet() 
@@ -765,7 +764,7 @@ public class Reference extends SignatureElementProxy {
     }
     
     /*
-     * 정성근 선임에 의해 추가되었다.
+     * INFO: this is added by sunggun.jung
      */
     /**
      * Method calculateDigest
@@ -777,52 +776,52 @@ public class Reference extends SignatureElementProxy {
      * @throws XMLSignatureException
      */
     public String calculateDigestBase64Endoed(String absoulteUrl) throws IOException {
-       String SHA = "";
-       
-       FileInputStream fis = null;
-       
-       try{
-               MessageDigest sha = MessageDigest.getInstance("SHA-256");
-               
-               fis = new FileInputStream(absoulteUrl);
-               
-               byte[] dataBytes = new byte[1024];
-               
-               int nread = 0;
-               
-               while ((nread = fis.read(dataBytes)) != -1)
-               {
-                       sha.update(dataBytes, 0, nread);
-               }
-               
-               byte[] shabytes = sha.digest();                 
-               
-//             StringBuffer sb = new StringBuffer();
-//             for (int i = 0 ; i < shabytes.length ; i++) {
-//                     sb.append(Integer.toString((shabytes[i]&0xff) + 0x100, 16).substring(1));
-//             }
-               
-//             System.out.println("Hex format : " + sb.toString());                    
-               SHA = Base64.encode(shabytes);
-//             System.out.println("Base64 format : " + SHA);
-               
-               fis.close();
-               
-       } catch (NoSuchAlgorithmException e) {
-               e.printStackTrace();
-               SHA = null;
-       } finally {
-               try {
-                               if (fis != null) {
-                                       fis.close();
-                               }                       
-                       } catch (IOException ex) {
-                   if (log.isDebugEnabled()) {
-                       log.debug(ex);
-                   }
-                       }
-               }       
-       return SHA;
+        String SHA = "";
+        
+        FileInputStream fis = null;
+        
+        try{
+            MessageDigest sha = MessageDigest.getInstance("SHA-256");
+            
+            fis = new FileInputStream(absoulteUrl);
+            
+            byte[] dataBytes = new byte[1024];
+            
+            int nread = 0;
+            
+            while ((nread = fis.read(dataBytes)) != -1)
+            {
+                sha.update(dataBytes, 0, nread);
+            }
+            
+            byte[] shabytes = sha.digest();
+            
+//            StringBuffer sb = new StringBuffer();
+//            for (int i = 0 ; i < shabytes.length ; i++) {
+//                sb.append(Integer.toString((shabytes[i]&0xff) + 0x100, 16).substring(1));
+//            }
+            
+//            System.out.println("Hex format : " + sb.toString());
+            SHA = Base64.encode(shabytes);
+//            System.out.println("Base64 format : " + SHA);
+            
+            fis.close();
+            
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+            SHA = null;
+        } finally {
+            try {
+                if (fis != null) {
+                    fis.close();
+                }            
+            } catch (IOException ex) {
+                if (log.isDebugEnabled()) {
+                    log.debug(ex);
+                }
+            }
+        }        
+        return SHA;
     }
     
 
index 0d42b92..1f259f8 100644 (file)
@@ -589,13 +589,13 @@ public final class XMLSignature extends SignatureElementProxy {
             OutputStream so = null;
             try {
                 // initialize SignatureAlgorithm for signing
-                sa.initSign(signingKey);            
+                sa.initSign(signingKey);
 
                 // generate digest values for all References in this SignedInfo
                 si.generateDigestValues();
                 so = new UnsyncBufferedOutputStream(new SignerOutputStream(sa));
                 // get the canonicalized bytes from SignedInfo
-                si.signInOctetStream(so);                
+                si.signInOctetStream(so);
             } catch (XMLSecurityException ex) {
                 throw ex;
             } finally {
@@ -644,29 +644,28 @@ public final class XMLSignature extends SignatureElementProxy {
 
         try {
             //Create a SignatureAlgorithm object
-            SignedInfo si = this.getSignedInfo();     
+            SignedInfo si = this.getSignedInfo();
             SignatureAlgorithm sa = si.getSignatureAlgorithm();
             OutputStream so = null;
             try {
                 // initialize SignatureAlgorithm for signing
-                sa.initSign(signingKey);            
+                sa.initSign(signingKey);
 
                 /*
                  * INFO: for RDS
                  */
                 // generate digest values for all References in this SignedInfo
                 try {
-                       if (isRDS == true)
-                               si.generateDigestValuesForRDS(dirPath);
-                       else
-                               si.generateDigestValuesAndWriteSnapshot(dirPath);
-                               } catch (IOException e) {
-                                       // TODO Auto-generated catch block
-                                       e.printStackTrace();
-                               }
+                    if (isRDS == true)
+                        si.generateDigestValuesForRDS(dirPath);
+                    else
+                        si.generateDigestValuesAndWriteSnapshot(dirPath);
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
                 so = new UnsyncBufferedOutputStream(new SignerOutputStream(sa));
                 // get the canonicalized bytes from SignedInfo
-                si.signInOctetStream(so);        
+                si.signInOctetStream(so);
             } catch (XMLSecurityException ex) {
                 throw ex;
             } finally {