kz.gamma.cms
Class CMSVistaEnvelopedData

java.lang.Object
  extended by kz.gamma.cms.CMSVistaEnvelopedData

public class CMSVistaEnvelopedData
extends java.lang.Object

Author:
Sergey Moisseyev, Renat Karimov

Nested Class Summary
protected  class CMSVistaEnvelopedData.RecipientInfoGamma
           
 
Field Summary
private  byte[] content
           
private  X509Name dnSenderIssuer
           
(package private)  GammaGOST28147 enc
           
(package private)  java.security.cert.X509Certificate exchSenderCert
           
private  X509Name exchSenderName
           
private  byte[] exchSenderSn
           
private static byte[] h1
           
private  java.util.List recipientInfos
           
private  java.util.List<X509Name> recipientsNames
           
(package private)  java.security.PrivateKey senderKey
           
private  ASN1EncodableVector unAttr
           
private  AttributeTable unAttrTable
           
private  int version
           
 
Constructor Summary
CMSVistaEnvelopedData()
           
CMSVistaEnvelopedData(byte[] cmsDevelopedBuf)
          Чтение зашифрованного пакета.
 
Method Summary
 void addKeyRecipient(java.security.cert.X509Certificate recipientCert)
          Добавление получателя сообщения.
 void addUnprotectedAttrs(Attribute attr)
          Добавление не защищенных аттрибутов сообщения.
 byte[] cryptText(byte[] buf)
          Шифрование сообщения
 byte[] decryptText(java.security.KeyStore store, java.lang.String password, byte[] crpData, java.security.cert.X509Certificate exchSenderCert)
          Расшифровывание сообщения
 EnvelopedData generateEnvelopedData(java.security.cert.X509Certificate cert, boolean isInclude)
          Формирование шифрованного сообщения Enveloped CMS.
 void genSessionKey(JCEECPrivateKey privKey)
           
 DERObject getAttributeByOid(AttributeTable attributeTable, java.lang.String oid)
          Получение атрибута
 java.security.cert.X509Certificate getExchSenderCert()
           
 X509Name getExchSenderName()
           
 byte[] getExchSenderSn()
           
 java.util.List getRecipientInfos()
           
 java.util.List<X509Name> getRecipientsNames()
           
 java.util.List getRecipientsSerialNumbers()
           
 ASN1EncodableVector getUnAttr()
           
 void initDHParameter(java.security.PrivateKey key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

recipientInfos

private java.util.List recipientInfos

unAttr

private ASN1EncodableVector unAttr

unAttrTable

private AttributeTable unAttrTable

version

private int version

dnSenderIssuer

private X509Name dnSenderIssuer

exchSenderSn

private byte[] exchSenderSn

exchSenderName

private X509Name exchSenderName

exchSenderCert

java.security.cert.X509Certificate exchSenderCert

senderKey

java.security.PrivateKey senderKey

recipientsNames

private java.util.List<X509Name> recipientsNames

content

private byte[] content

h1

private static byte[] h1

enc

GammaGOST28147 enc
Constructor Detail

CMSVistaEnvelopedData

public CMSVistaEnvelopedData()

CMSVistaEnvelopedData

public CMSVistaEnvelopedData(byte[] cmsDevelopedBuf)
                      throws java.io.IOException,
                             java.security.NoSuchProviderException,
                             java.security.cert.CertificateException,
                             CMSException,
                             java.security.NoSuchAlgorithmException
Чтение зашифрованного пакета.

Parameters:
cmsDevelopedBuf - зашифрованный пакет
Throws:
java.io.IOException
java.security.NoSuchProviderException
java.security.cert.CertificateException
CMSException
java.security.NoSuchAlgorithmException
Method Detail

generateEnvelopedData

public EnvelopedData generateEnvelopedData(java.security.cert.X509Certificate cert,
                                           boolean isInclude)
                                    throws java.security.cert.CertificateEncodingException,
                                           java.io.IOException
Формирование шифрованного сообщения Enveloped CMS.

Parameters:
cert - Сертификат отправителя шифрованного сообщения
Throws:
java.security.cert.CertificateEncodingException
java.io.IOException

addKeyRecipient

public void addKeyRecipient(java.security.cert.X509Certificate recipientCert)
Добавление получателя сообщения.

Parameters:
recipientCert - Сертификат получателя шифрованного сообщения

addUnprotectedAttrs

public void addUnprotectedAttrs(Attribute attr)
Добавление не защищенных аттрибутов сообщения.

Parameters:
attr - аттрибут

getAttributeByOid

public DERObject getAttributeByOid(AttributeTable attributeTable,
                                   java.lang.String oid)
Получение атрибута

Parameters:
oid - OID Возможные варианты:
  • 1.3.6.1.4.1.6801.2.8 - отправитель;
  • 1.3.6.1.4.1.6801.2.9 - получатель.
Returns:
Атрибут

cryptText

public byte[] cryptText(byte[] buf)
Шифрование сообщения

Parameters:
buf - текст сообщения который необходимо зашифровать

genSessionKey

public void genSessionKey(JCEECPrivateKey privKey)

decryptText

public byte[] decryptText(java.security.KeyStore store,
                          java.lang.String password,
                          byte[] crpData,
                          java.security.cert.X509Certificate exchSenderCert)
Расшифровывание сообщения

Parameters:
store - хранилище закрытого ключа получателя сообщения
password - Пароль для доступа к ключевому контейнеру
Returns:
Расшифрованное сообщение

getExchSenderCert

public java.security.cert.X509Certificate getExchSenderCert()

getUnAttr

public ASN1EncodableVector getUnAttr()

initDHParameter

public void initDHParameter(java.security.PrivateKey key)

getRecipientInfos

public java.util.List getRecipientInfos()

getRecipientsSerialNumbers

public java.util.List getRecipientsSerialNumbers()

getRecipientsNames

public java.util.List<X509Name> getRecipientsNames()

getExchSenderSn

public byte[] getExchSenderSn()

getExchSenderName

public X509Name getExchSenderName()


Copyright © 1998-2014 Gamma Technologies. All Rights Reserved.