Search in sources :

Example 36 with Signature

use of net.i2p.data.Signature in project i2p.i2p-bote by i2p.

the class ElGamal2048_DSA1024 method sign.

/**
 * Only accepts <code>DSAPrivateKey</code>s.
 */
@Override
public byte[] sign(byte[] data, PrivateKey privateKey, KeyUpdateHandler keyupdateHandler) throws GeneralSecurityException {
    DSAPrivateKey dsaKey = castToDSA(privateKey);
    Signature signature = DSAEngine.getInstance().sign(data, dsaKey.getI2PKey());
    return signature.toByteArray();
}
Also used : Signature(net.i2p.data.Signature)

Aggregations

Signature (net.i2p.data.Signature)36 IOException (java.io.IOException)16 SigType (net.i2p.crypto.SigType)14 DataFormatException (net.i2p.data.DataFormatException)11 SigningPublicKey (net.i2p.data.SigningPublicKey)11 ByteArrayInputStream (java.io.ByteArrayInputStream)7 GeneralSecurityException (java.security.GeneralSecurityException)6 FileInputStream (java.io.FileInputStream)5 StringWriter (java.io.StringWriter)5 SigningPrivateKey (net.i2p.data.SigningPrivateKey)5 InetAddress (java.net.InetAddress)4 MessageDigest (java.security.MessageDigest)4 Destination (net.i2p.data.Destination)4 SimpleDataStructure (net.i2p.data.SimpleDataStructure)4 FileOutputStream (java.io.FileOutputStream)3 InputStream (java.io.InputStream)3 DigestInputStream (java.security.DigestInputStream)3 Hash (net.i2p.data.Hash)3 Log (net.i2p.util.Log)3 SecureFileOutputStream (net.i2p.util.SecureFileOutputStream)3