Index: src/main/java/com/itextpdf/text/pdf/PdfName.java
===================================================================
--- src/main/java/com/itextpdf/text/pdf/PdfName.java	(revision 6465)
+++ src/main/java/com/itextpdf/text/pdf/PdfName.java	(working copy)
@@ -111,7 +111,9 @@
      * @since 2.1.6
      */
     public static final PdfName ACTUALTEXT = new PdfName("ActualText");
-    /** A name */
+    /** A name.
+     * 01/22/12 Используется для подписи на алгоритмах ГОСТ Р 34.10-2001/2012.
+     */
     public static final PdfName ADBE_PKCS7_DETACHED = new PdfName("adbe.pkcs7.detached");
     /** A name */
     public static final PdfName ADBE_PKCS7_S4 =new PdfName("adbe.pkcs7.s4");
@@ -125,6 +127,9 @@
     public static final PdfName ADOBE_PPKLITE = new PdfName("Adobe.PPKLite");
     /** A name */
     public static final PdfName ADOBE_PPKMS = new PdfName("Adobe.PPKMS");
+    /** A name. 
+    * 01/22/12 для ГОСТ Р 34.10-2001/2012, filter */
+    public static final PdfName ADOBE_CryptoProPDF = new PdfName("CryptoPro PDF"); 
     /** A name */
     public static final PdfName AESV2 = new PdfName("AESV2");
     /** A name */
Index: src/main/java/com/itextpdf/text/pdf/PdfPKCS7.java
===================================================================
--- src/main/java/com/itextpdf/text/pdf/PdfPKCS7.java	(revision 6465)
+++ src/main/java/com/itextpdf/text/pdf/PdfPKCS7.java	(working copy)
@@ -55,6 +55,7 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchProviderException;
 import java.security.PrivateKey;
+import java.security.PublicKey;
 import java.security.Signature;
 import java.security.SignatureException;
 import java.security.cert.CRL;
@@ -119,8 +120,11 @@
 import org.bouncycastle.asn1.x509.GeneralName;
 import org.bouncycastle.asn1.x509.GeneralNames;
 import org.bouncycastle.jce.provider.CertPathValidatorUtilities;
-import org.bouncycastle.jce.provider.RFC3280CertPathUtilities;
+//import org.bouncycastle.jce.provider.RFC3280CertPathUtilities;
 
+import ru.CryptoPro.JCP.JCP;
+import ru.CryptoPro.reprov.x509.X509CertImpl;
+
 /**
  * This class does all the processing related to signing and verifying a PKCS#7
  * signature.
@@ -154,6 +158,14 @@
     private static final String ID_PKCS7_SIGNED_DATA = "1.2.840.113549.1.7.2";
     private static final String ID_RSA = "1.2.840.113549.1.1.1";
     private static final String ID_DSA = "1.2.840.10040.4.1";
+    
+    private static final String ID_GOST3410EL = ru.CryptoPro.JCP.params.Consts.OID_19;   // 01/22/12 идентификатор набора параметров ГОСТ Р 34.10-2001
+    private static final String ID_GOST3410DHEL = ru.CryptoPro.JCP.params.Consts.OID_98; // 01/22/12 идентификатор набора параметров ГОСТ Р 34.10-2001
+    private static final String ID_GOST3410EL_2012_256 = ru.CryptoPro.JCP.params.Consts.OID_PARAMS_SIG_2012_256;   // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (256)
+    private static final String ID_GOST3410DHEL_2012_256 = ru.CryptoPro.JCP.params.Consts.OID_PARAMS_EXC_2012_256; // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (256) DH
+    private static final String ID_GOST3410EL_2012_512 = ru.CryptoPro.JCP.params.Consts.OID_PARAMS_SIG_2012_512;   // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (512)
+    private static final String ID_GOST3410DHEL_2012_512 = ru.CryptoPro.JCP.params.Consts.OID_PARAMS_EXC_2012_512; // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (512) DH
+    
     private static final String ID_CONTENT_TYPE = "1.2.840.113549.1.9.3";
     private static final String ID_MESSAGE_DIGEST = "1.2.840.113549.1.9.4";
     private static final String ID_SIGNING_TIME = "1.2.840.113549.1.9.5";
@@ -212,6 +224,10 @@
         digestNames.put("1.3.36.3.3.1.3", "RIPEMD128");
         digestNames.put("1.3.36.3.3.1.2", "RIPEMD160");
         digestNames.put("1.3.36.3.3.1.4", "RIPEMD256");
+        
+        digestNames.put(JCP.GOST_DIGEST_OID, JCP.GOST_DIGEST_NAME); 				  // 01/22/12 алгоритм хеширования ГОСТ Р 34.11-94
+        digestNames.put(JCP.GOST_DIGEST_2012_256_OID, JCP.GOST_DIGEST_2012_256_NAME); // 10/07/14 алгоритм хеширования ГОСТ Р 34.11-2012 (256)
+        digestNames.put(JCP.GOST_DIGEST_2012_512_OID, JCP.GOST_DIGEST_2012_512_NAME); // 10/07/14 алгоритм хеширования ГОСТ Р 34.11-2012 (512)
 
         algorithmNames.put("1.2.840.113549.1.1.1", "RSA");
         algorithmNames.put("1.2.840.10040.4.1", "DSA");
@@ -228,7 +244,14 @@
         algorithmNames.put("1.3.36.3.3.1.3", "RSA");
         algorithmNames.put("1.3.36.3.3.1.2", "RSA");
         algorithmNames.put("1.3.36.3.3.1.4", "RSA");
-
+        
+        algorithmNames.put(ID_GOST3410EL, JCP.GOST_EL_DEGREE_NAME); 			 // 01/22/12 идентификатор набора параметров ГОСТ Р 34.10-2001
+        algorithmNames.put(ID_GOST3410DHEL, JCP.GOST_EL_DH_NAME); 				 // 01/22/12 идентификатор набора параметров ГОСТ Р 34.10-2001 DH
+        algorithmNames.put(ID_GOST3410EL_2012_256, JCP.GOST_EL_2012_256_NAME);   // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (256)
+        algorithmNames.put(ID_GOST3410DHEL_2012_256, JCP.GOST_DH_2012_256_NAME); // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (256) DH
+        algorithmNames.put(ID_GOST3410EL_2012_512, JCP.GOST_EL_2012_512_NAME);   // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (512)
+        algorithmNames.put(ID_GOST3410DHEL_2012_512, JCP.GOST_DH_2012_512_NAME); // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (512) DH
+        
         allowedDigests.put("MD5", "1.2.840.113549.2.5");
         allowedDigests.put("MD2", "1.2.840.113549.2.2");
         allowedDigests.put("SHA1", "1.3.14.3.2.26");
@@ -249,6 +272,10 @@
         allowedDigests.put("RIPEMD-160", "1.3.36.3.2.1");
         allowedDigests.put("RIPEMD256", "1.3.36.3.2.3");
         allowedDigests.put("RIPEMD-256", "1.3.36.3.2.3");
+        
+        allowedDigests.put(JCP.GOST_DIGEST_NAME, JCP.GOST_DIGEST_OID); 					 // 01/22/12 алгоритм хеширования ГОСТ Р 34.11-94
+        allowedDigests.put(JCP.GOST_DIGEST_2012_256_NAME, JCP.GOST_DIGEST_2012_256_OID); // 10/07/14 алгоритм хеширования ГОСТ Р 34.11-2012 (256)
+        allowedDigests.put(JCP.GOST_DIGEST_2012_512_NAME, JCP.GOST_DIGEST_2012_512_OID); // 10/07/14 алгоритм хеширования ГОСТ Р 34.11-2012 (512)
     }
 
     /**
@@ -325,7 +352,7 @@
             digest = ((DEROctetString)in.readObject()).getOctets();
             if (provider == null)
                 sig = Signature.getInstance("SHA1withRSA");
-            else
+            else	
                 sig = Signature.getInstance("SHA1withRSA", provider);
             sig.initVerify(signCert.getPublicKey());
         }
@@ -450,7 +477,7 @@
             X509CertParser cr = new X509CertParser();
             cr.engineInit(new ByteArrayInputStream(contentsKey));
             certs = cr.engineReadAll();
-
+            
             // the possible ID_PKCS7_DATA
             ASN1Sequence rsaData = (ASN1Sequence)content.getObjectAt(2);
             if (rsaData.size() > 1) {
@@ -550,7 +577,27 @@
                 sig = Signature.getInstance(getDigestAlgorithm());
             else
                 sig = Signature.getInstance(getDigestAlgorithm(), provider);
-            sig.initVerify(signCert.getPublicKey());
+            
+            PublicKey pk = null;
+            
+            // 10/07/14 Если провайдер JCP или Java CSP, полагаем, что имеем дело с ГОСТ.
+            if ( (provider != null && (provider.equalsIgnoreCase(JCP.PROVIDER_NAME) || provider.equalsIgnoreCase("JCSP"))) ||
+            	 (getHashAlgorithm().equalsIgnoreCase(JCP.GOST_DIGEST_NAME)     || 
+                  getHashAlgorithm().equalsIgnoreCase(JCP.GOST_DIGEST_OID)           ||
+                  getHashAlgorithm().equalsIgnoreCase(JCP.GOST_DIGEST_2012_256_NAME) ||
+                  getHashAlgorithm().equalsIgnoreCase(JCP.GOST_DIGEST_2012_256_OID)  ||
+                  getHashAlgorithm().equalsIgnoreCase(JCP.GOST_DIGEST_2012_512_NAME) ||
+                  getHashAlgorithm().equalsIgnoreCase(JCP.GOST_DIGEST_2012_512_OID))	
+               ) {
+            	X509Certificate tmpCert = new X509CertImpl(signCert.getEncoded());
+            	pk = tmpCert.getPublicKey();
+            }
+            else {
+            	pk = signCert.getPublicKey();
+            }
+            
+            sig.initVerify(pk);
+            
         }
         catch (Exception e) {
             throw new ExceptionConverter(e);
@@ -590,11 +637,12 @@
         //
         // Copy in the certificates and crls used to sign the private key.
         //
-        signCert = (X509Certificate)certChain[0];
-        for (Certificate element : certChain) {
-            certs.add(element);
-        }
-
+        
+        signCert = (X509Certificate) certChain[0];
+		for (Certificate element : certChain) {
+			certs.add(element);
+	    }
+		
         if (crlList != null) {
             for (CRL element : crlList) {
                 crls.add(element);
@@ -612,6 +660,30 @@
             else if (digestEncryptionAlgorithm.equals("DSA")) {
                 digestEncryptionAlgorithm = ID_DSA;
             }
+            // 01/22/12 идентификатор набора параметров ГОСТ Р 34.10-2001
+            else if (digestEncryptionAlgorithm.equals(JCP.GOST_EL_DEGREE_NAME)) {
+            	digestEncryptionAlgorithm = ID_GOST3410EL;
+            } 
+            // 01/22/12 идентификатор набора параметров ГОСТ Р 34.10-2001 DH
+            else  if (digestEncryptionAlgorithm.equals(JCP.GOST_EL_DH_NAME)) {
+            	digestEncryptionAlgorithm = ID_GOST3410DHEL;
+            }
+            // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (256)
+            else if (digestEncryptionAlgorithm.equals(JCP.GOST_EL_2012_256_NAME)) {
+            	digestEncryptionAlgorithm = ID_GOST3410EL_2012_256;
+            } 
+            // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (256) DH
+            else if (digestEncryptionAlgorithm.equals(JCP.GOST_DH_2012_256_NAME)) {
+            	digestEncryptionAlgorithm = ID_GOST3410DHEL_2012_256;
+            } 
+            // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (512)
+            else if (digestEncryptionAlgorithm.equals(JCP.GOST_EL_2012_512_NAME)) {
+            	digestEncryptionAlgorithm = ID_GOST3410EL_2012_512;
+            } 
+            // 10/07/14 идентификатор набора параметров ГОСТ Р 34.10-2012 (512) DH
+            else if (digestEncryptionAlgorithm.equals(JCP.GOST_DH_2012_512_NAME)) {
+            	digestEncryptionAlgorithm = ID_GOST3410DHEL_2012_512;
+            } 
             else {
                 throw new NoSuchAlgorithmException(MessageLocalization.getComposedMessage("unknown.key.algorithm.1", digestEncryptionAlgorithm));
             }
@@ -747,7 +819,9 @@
                 }
             }
         }
-        signCerts = cc;
+        
+       signCerts = cc;
+        
     }
 
     /**
@@ -908,13 +982,25 @@
                         X509Certificate certStoreX509 = (X509Certificate)keystore.getCertificate(alias);
                         if (verifyCertificate(certStoreX509, crls, calendar) != null)
                             continue;
+                        
                         try {
                             cert.verify(certStoreX509.getPublicKey());
                             return null;
                         }
                         catch (Exception e) {
-                            continue;
+                        	
+                        	// 10/07/14 Возможно, мы имеем дело с ГОСТ сертификатом
+ 
+                        	try {
+                        		X509Certificate tmpCert = new X509CertImpl(certStoreX509.getEncoded());
+                        		cert.verify(tmpCert.getPublicKey());
+                        	}
+                        	catch (Exception ee) {
+                        		continue;
+                        	}
+                        	
                         }
+                        
                     }
                     catch (Exception ex) {
                     }
@@ -927,12 +1013,25 @@
                 if (j == k)
                     continue;
                 X509Certificate certNext = (X509Certificate)certs[j];
+                
                 try {
                     cert.verify(certNext.getPublicKey());
                     break;
                 }
                 catch (Exception e) {
+
+                    // 10/07/14 Возможно, мы имеем дело с ГОСТ сертификатом
+
+                	try {
+                		X509Certificate tmpCert = new X509CertImpl(certNext.getEncoded());
+                		cert.verify(tmpCert.getPublicKey());
+                	}
+                	catch (Exception ee) {
+                		continue;
+                	}
+                	
                 }
+                
             }
             if (j == certs.length)
                 return new Object[]{cert, "Cannot be verified against the KeyStore or the certificate chain"};
Index: src/main/java/com/itextpdf/text/pdf/PdfSigGenericPKCS.java
===================================================================
--- src/main/java/com/itextpdf/text/pdf/PdfSigGenericPKCS.java	(revision 6465)
+++ src/main/java/com/itextpdf/text/pdf/PdfSigGenericPKCS.java	(working copy)
@@ -48,6 +48,8 @@
 import java.security.cert.CRL;
 import java.security.cert.Certificate;
 
+import ru.CryptoPro.JCP.JCP;
+
 import com.itextpdf.text.ExceptionConverter;
 
 /**
@@ -234,4 +236,76 @@
             this.provider = provider;
         }
     }
+    
+    /** 
+     * 01/22/12
+    * Creates a standard filter of the type CryptoPro PDF 
+    * (алгоритм хеширования ГОСТ Р 34.11-94).
+    */    
+    public static class PPCryptoProPDF_3411 extends PdfSigGenericPKCS {
+    	/**
+    	 * The constructor for the default provider.
+    	 */        
+    	public PPCryptoProPDF_3411() {
+    		super(PdfName.ADOBE_CryptoProPDF, PdfName.ADBE_PKCS7_DETACHED);
+    		hashAlgorithm = JCP.GOST_DIGEST_NAME;
+    	}
+
+    	/**
+    	* The constructor for an explicit provider.
+    	* @param provider the crypto provider
+    	*/        
+    	public PPCryptoProPDF_3411(String provider) {
+    		this();
+    		this.provider = provider;
+    	}
+    } 
+    
+    /** 
+     * 10/07/14
+    * Creates a standard filter of the type CryptoPro PDF 
+    * (алгоритм хеширования ГОСТ Р 34.11-2012 (256)).
+    */    
+    public static class PPCryptoProPDF_3411_2012_256 extends PdfSigGenericPKCS {
+    	/**
+    	 * The constructor for the default provider.
+    	 */        
+    	public PPCryptoProPDF_3411_2012_256() {
+    		super(PdfName.ADOBE_CryptoProPDF, PdfName.ADBE_PKCS7_DETACHED);
+    		hashAlgorithm = JCP.GOST_DIGEST_2012_256_NAME;
+    	}
+
+    	/**
+    	* The constructor for an explicit provider.
+    	* @param provider the crypto provider
+    	*/        
+    	public PPCryptoProPDF_3411_2012_256(String provider) {
+    		this();
+    		this.provider = provider;
+    	}
+    }
+    
+    /** 
+     * 10/07/14
+    * Creates a standard filter of the type CryptoPro PDF 
+    * (алгоритм хеширования ГОСТ Р 34.11-2012 (256)).
+    */    
+    public static class PPCryptoProPDF_3411_2012_512 extends PdfSigGenericPKCS {
+    	/**
+    	 * The constructor for the default provider.
+    	 */        
+    	public PPCryptoProPDF_3411_2012_512() {
+    		super(PdfName.ADOBE_CryptoProPDF, PdfName.ADBE_PKCS7_DETACHED);
+    		hashAlgorithm = JCP.GOST_DIGEST_2012_512_NAME;
+    	}
+
+    	/**
+    	* The constructor for an explicit provider.
+    	* @param provider the crypto provider
+    	*/        
+    	public PPCryptoProPDF_3411_2012_512(String provider) {
+    		this();
+    		this.provider = provider;
+    	}
+    }
 }
Index: src/main/java/com/itextpdf/text/pdf/PdfSignatureAppearance.java
===================================================================
--- src/main/java/com/itextpdf/text/pdf/PdfSignatureAppearance.java	(revision 6465)
+++ src/main/java/com/itextpdf/text/pdf/PdfSignatureAppearance.java	(working copy)
@@ -60,6 +60,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import ru.CryptoPro.JCP.JCP;
+
 import com.itextpdf.text.Chunk;
 import com.itextpdf.text.DocumentException;
 import com.itextpdf.text.Element;
@@ -111,6 +113,11 @@
      * The Windows Certificate Security.
      */
     public static final PdfName WINCER_SIGNED = PdfName.ADOBE_PPKMS;
+    
+    /**
+    * 01/22/12 Фильтр для подписи на алгоритмах ГОСТ Р 34.10-94/2012.
+    */
+    public static final PdfName CRYPTOPRO_SIGNED = PdfName.ADOBE_CryptoProPDF;
 
     public static final int NOT_CERTIFIED = 0;
     public static final int CERTIFIED_NO_CHANGES_ALLOWED = 1;
@@ -959,6 +966,28 @@
                 sigStandard = new PdfSigGenericPKCS.PPKLite(getProvider());
             else if (PdfName.ADOBE_PPKMS.equals(getFilter()))
                 sigStandard = new PdfSigGenericPKCS.PPKMS(getProvider());
+            // 01/22/12 Фильтр для ГОСТ подписи
+            else if (PdfName.ADOBE_CryptoProPDF.equals(getFilter())) {
+            	
+            	PrivateKey pk = getPrivKey();
+            	String pkAlgName = pk.getAlgorithm();
+
+            	// 10/07/14 Алгоритм подписи 34.10-2012 (256)
+            	if (pkAlgName.equalsIgnoreCase(JCP.GOST_EL_2012_256_NAME) || 
+            		pkAlgName.equalsIgnoreCase(JCP.GOST_DH_2012_256_NAME)) {
+                	sigStandard = new PdfSigGenericPKCS.PPCryptoProPDF_3411_2012_256(getProvider());
+                }
+            	// 10/07/14 Алгоритм подписи 34.10-2012 (512)
+            	else if (pkAlgName.equalsIgnoreCase(JCP.GOST_EL_2012_512_NAME) || 
+            		pkAlgName.equalsIgnoreCase(JCP.GOST_DH_2012_512_NAME)) {
+                    sigStandard = new PdfSigGenericPKCS.PPCryptoProPDF_3411_2012_512(getProvider());
+                }
+            	// 01/22/12 Алгоритм подписи 34.10-2001
+            	else {
+            		sigStandard = new PdfSigGenericPKCS.PPCryptoProPDF_3411(getProvider());
+            	}
+            	
+            }
             else if (PdfName.VERISIGN_PPKVS.equals(getFilter()))
                 sigStandard = new PdfSigGenericPKCS.VeriSign(getProvider());
             else
