kz.gamma.hardware.cms
Class CMSGammaEnvelopedData

java.lang.Object
  extended by kz.gamma.hardware.cms.CMSGammaEnvelopedData

public class CMSGammaEnvelopedData
extends java.lang.Object

Author:
Sergey Moisseyev, Renat Karimov

Nested Class Summary
protected  class CMSGammaEnvelopedData.RecipientInfoGamma
           
 
Field Summary
private  byte[] content
           
(package private)  CryptoObject cryptoObject
           
private  X509Name dnSenderIssuer
           
(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)  ParametersWithIV secKeyParam
           
(package private)  JCEPrivateKey senderKey
           
private  ASN1EncodableVector unAttr
           
private  AttributeTable unAttrTable
           
private  int version
           
 
Constructor Summary
CMSGammaEnvelopedData()
           
CMSGammaEnvelopedData(byte[] cmsDevelopedBuf)
          Чтение зашифрованного пакета.
 
Method Summary
 void addKeyRecipient(java.security.cert.X509Certificate recipientCert)
          Добавление получателя сообщения.
 void addUnprotectedAttrs(Attribute attr)
          Добавление не защищенных аттрибутов сообщения.
 byte[] cryptText(byte[] buf, boolean includeContent)
          Шифрование сообщения
 byte[] decryptText(CryptoObject object, java.lang.String pass, java.security.cert.X509Certificate senderCert, byte[] crpData)
          Расшифровывание сообщения
 EnvelopedData generateEnvelopedData(java.security.cert.X509Certificate cert, boolean isInclude)
          Формирование шифрованного сообщения Enveloped CMS.
 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(CryptoObject cryptoObject, JCEPrivateKey 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

JCEPrivateKey senderKey

recipientsNames

private java.util.List<X509Name> recipientsNames

content

private byte[] content

h1

private static byte[] h1

secKeyParam

ParametersWithIV secKeyParam

cryptoObject

CryptoObject cryptoObject
Constructor Detail

CMSGammaEnvelopedData

public CMSGammaEnvelopedData()

CMSGammaEnvelopedData

public CMSGammaEnvelopedData(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,
                        boolean includeContent)
Шифрование сообщения

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

decryptText

public byte[] decryptText(CryptoObject object,
                          java.lang.String pass,
                          java.security.cert.X509Certificate senderCert,
                          byte[] crpData)
Расшифровывание сообщения

Parameters:
object - хранилище закрытого ключа получателя сообщения
pass - пароль на доступ к ключам
senderCert - сертификат отправителя
crpData - зашифрованные данные (может быть null, если данные вложены)
Returns:
Расшифрованное сообщение

getUnAttr

public ASN1EncodableVector getUnAttr()

initDHParameter

public void initDHParameter(CryptoObject cryptoObject,
                            JCEPrivateKey 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()

getExchSenderCert

public java.security.cert.X509Certificate getExchSenderCert()


Copyright © 2013 Gamma Technologies. All Rights Reserved.