net.java.otr4j.crypto
Class OtrCryptoEngineImpl

Package class diagram package OtrCryptoEngineImpl
java.lang.Object
  extended by net.java.otr4j.crypto.OtrCryptoEngineImpl
All Implemented Interfaces:
OtrCryptoEngine

public class OtrCryptoEngineImpl
extends Object
implements OtrCryptoEngine


Field Summary
 
Fields inherited from interface net.java.otr4j.crypto.OtrCryptoEngine
AES_KEY_BYTE_LENGTH, BIGINTEGER_TWO, DH_PRIVATE_KEY_MINIMUM_BIT_LENGTH, DSA_PUB_TYPE, GENERATOR, GENERATOR_TEXT, MODULUS, MODULUS_MINUS_TWO, MODULUS_TEXT, SHA256_HMAC_KEY_BYTE_LENGTH, ZERO_CTR
 
Constructor Summary
OtrCryptoEngineImpl()
           
 
Method Summary
 byte[] aesDecrypt(byte[] key, byte[] ctr, byte[] b)
           
 byte[] aesEncrypt(byte[] key, byte[] ctr, byte[] b)
           
 KeyPair generateDHKeyPair()
           
 BigInteger generateSecret(PrivateKey privKey, PublicKey pubKey)
           
 DHPublicKey getDHPublicKey(BigInteger mpi)
           
 DHPublicKey getDHPublicKey(byte[] mpiBytes)
           
 String getFingerprint(PublicKey pubKey)
           
 byte[] sha1Hash(byte[] b)
           
 byte[] sha1Hmac(byte[] b, byte[] key, int length)
           
 byte[] sha256Hash(byte[] b)
           
 byte[] sha256Hmac(byte[] b, byte[] key)
           
 byte[] sha256Hmac(byte[] b, byte[] key, int length)
           
 byte[] sha256Hmac160(byte[] b, byte[] key)
           
 byte[] sign(byte[] b, PrivateKey privatekey)
           
 boolean verify(byte[] b, PublicKey pubKey, byte[] rs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OtrCryptoEngineImpl

public OtrCryptoEngineImpl()
Method Detail

generateDHKeyPair

public KeyPair generateDHKeyPair()
                          throws OtrCryptoException
Specified by:
generateDHKeyPair in interface OtrCryptoEngine
Throws:
OtrCryptoException

getDHPublicKey

public DHPublicKey getDHPublicKey(byte[] mpiBytes)
                           throws OtrCryptoException
Specified by:
getDHPublicKey in interface OtrCryptoEngine
Throws:
OtrCryptoException

getDHPublicKey

public DHPublicKey getDHPublicKey(BigInteger mpi)
                           throws OtrCryptoException
Specified by:
getDHPublicKey in interface OtrCryptoEngine
Throws:
OtrCryptoException

sha256Hmac

public byte[] sha256Hmac(byte[] b,
                         byte[] key)
                  throws OtrCryptoException
Specified by:
sha256Hmac in interface OtrCryptoEngine
Throws:
OtrCryptoException

sha256Hmac

public byte[] sha256Hmac(byte[] b,
                         byte[] key,
                         int length)
                  throws OtrCryptoException
Specified by:
sha256Hmac in interface OtrCryptoEngine
Throws:
OtrCryptoException

sha1Hmac

public byte[] sha1Hmac(byte[] b,
                       byte[] key,
                       int length)
                throws OtrCryptoException
Specified by:
sha1Hmac in interface OtrCryptoEngine
Throws:
OtrCryptoException

sha256Hmac160

public byte[] sha256Hmac160(byte[] b,
                            byte[] key)
                     throws OtrCryptoException
Specified by:
sha256Hmac160 in interface OtrCryptoEngine
Throws:
OtrCryptoException

sha256Hash

public byte[] sha256Hash(byte[] b)
                  throws OtrCryptoException
Specified by:
sha256Hash in interface OtrCryptoEngine
Throws:
OtrCryptoException

sha1Hash

public byte[] sha1Hash(byte[] b)
                throws OtrCryptoException
Specified by:
sha1Hash in interface OtrCryptoEngine
Throws:
OtrCryptoException

aesDecrypt

public byte[] aesDecrypt(byte[] key,
                         byte[] ctr,
                         byte[] b)
                  throws OtrCryptoException
Specified by:
aesDecrypt in interface OtrCryptoEngine
Throws:
OtrCryptoException

aesEncrypt

public byte[] aesEncrypt(byte[] key,
                         byte[] ctr,
                         byte[] b)
                  throws OtrCryptoException
Specified by:
aesEncrypt in interface OtrCryptoEngine
Throws:
OtrCryptoException

generateSecret

public BigInteger generateSecret(PrivateKey privKey,
                                 PublicKey pubKey)
                          throws OtrCryptoException
Specified by:
generateSecret in interface OtrCryptoEngine
Throws:
OtrCryptoException

sign

public byte[] sign(byte[] b,
                   PrivateKey privatekey)
            throws OtrCryptoException
Specified by:
sign in interface OtrCryptoEngine
Throws:
OtrCryptoException

verify

public boolean verify(byte[] b,
                      PublicKey pubKey,
                      byte[] rs)
               throws OtrCryptoException
Specified by:
verify in interface OtrCryptoEngine
Throws:
OtrCryptoException

getFingerprint

public String getFingerprint(PublicKey pubKey)
                      throws OtrCryptoException
Specified by:
getFingerprint in interface OtrCryptoEngine
Throws:
OtrCryptoException


Copyright © 2009 Beem-project.com. All Rights Reserved.