com.hejinonline.util.Security.scala Maven / Gradle / Ivy
The newest version!
package com.hejinonline.util
import java.security._
object PKI {
/*
def generateKeyPair() = {
val generator =
.getInstance("DSA", "SUN")
val random = SecureRandom.getInstance("SHA1PRNG", "SUN");
generator.initialize(1024, random);
generator.generateKeyPair()
}
def sign(privateKey: PrivateKey, document: String):String = {
val sig = Signature.getInstance("SHA1withDSA", "SUN");
sig.initialize(privateKey, document.getBytes)
Base58.encode(sig.sign())
}
}
def verifySignature(publicKey: PublicKey, signature: String):Boolean = {
val sig = Signature.getInstance("SHA1withDSA", "SUN");
sig.initVerify(publicKey)
sig.verify(Base58.decode(signature))
}*/
}