mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 12:27:58 +01:00
Add documentation for toSecretKey method
This commit is contained in:
parent
8e1e90c89a
commit
fa9b07d2ce
4 changed files with 12 additions and 16 deletions
|
@ -270,6 +270,14 @@ open class GenerateOpenPgpKey(
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a [OpenPgpComponentKeyBuilder.V4ComponentKeyBuilder] to a version 4
|
||||||
|
* [PGPSecretKey].
|
||||||
|
*
|
||||||
|
* @param key builder
|
||||||
|
* @param isPrimaryKey if true, the result will be a primary key, a subkey otherwise.
|
||||||
|
* @param encryptor encryptor to protect the secret key. Can be null for unencrypted keys.
|
||||||
|
*/
|
||||||
private fun toSecretKey(
|
private fun toSecretKey(
|
||||||
key: OpenPgpComponentKeyBuilder.V4ComponentKeyBuilder<*>,
|
key: OpenPgpComponentKeyBuilder.V4ComponentKeyBuilder<*>,
|
||||||
isPrimaryKey: Boolean,
|
isPrimaryKey: Boolean,
|
||||||
|
|
|
@ -100,16 +100,10 @@ interface KeyType {
|
||||||
|
|
||||||
@JvmStatic fun ECDSA(curve: EllipticCurve): ECDSA = ECDSA.fromCurve(curve)
|
@JvmStatic fun ECDSA(curve: EllipticCurve): ECDSA = ECDSA.fromCurve(curve)
|
||||||
|
|
||||||
/**
|
/** Legacy EdDSA using Ed25519. For OpenPGP v4 only. */
|
||||||
* Legacy EdDSA using Ed25519.
|
|
||||||
* For OpenPGP v4 only.
|
|
||||||
*/
|
|
||||||
@JvmStatic fun EDDSA(curve: EdDSACurve): EdDSA = EdDSA.fromCurve(curve)
|
@JvmStatic fun EDDSA(curve: EdDSACurve): EdDSA = EdDSA.fromCurve(curve)
|
||||||
|
|
||||||
/**
|
/** Legacy ECDH using Curve25519. For OpenPGP v4 only. */
|
||||||
* Legacy ECDH using Curve25519.
|
|
||||||
* For OpenPGP v4 only.
|
|
||||||
*/
|
|
||||||
@JvmStatic fun XDH(curve: XDHSpec): XDH = XDH.fromSpec(curve)
|
@JvmStatic fun XDH(curve: XDHSpec): XDH = XDH.fromSpec(curve)
|
||||||
|
|
||||||
// TODO: Add crypto-refresh X25519, X448, Ed25519, Ed448
|
// TODO: Add crypto-refresh X25519, X448, Ed25519, Ed448
|
||||||
|
|
|
@ -8,10 +8,7 @@ import org.bouncycastle.jce.spec.ECNamedCurveGenParameterSpec
|
||||||
import org.pgpainless.algorithm.PublicKeyAlgorithm
|
import org.pgpainless.algorithm.PublicKeyAlgorithm
|
||||||
import org.pgpainless.key.generation.type.KeyType
|
import org.pgpainless.key.generation.type.KeyType
|
||||||
|
|
||||||
/**
|
/** Legacy EdDSA using Ed25519. For use with OpenPGP v4 only. */
|
||||||
* Legacy EdDSA using Ed25519.
|
|
||||||
* For use with OpenPGP v4 only.
|
|
||||||
*/
|
|
||||||
class EdDSA private constructor(val curve: EdDSACurve) : KeyType {
|
class EdDSA private constructor(val curve: EdDSACurve) : KeyType {
|
||||||
override val name = "EdDSA"
|
override val name = "EdDSA"
|
||||||
override val algorithm = PublicKeyAlgorithm.EDDSA
|
override val algorithm = PublicKeyAlgorithm.EDDSA
|
||||||
|
|
|
@ -8,10 +8,7 @@ import org.bouncycastle.jce.spec.ECNamedCurveGenParameterSpec
|
||||||
import org.pgpainless.algorithm.PublicKeyAlgorithm
|
import org.pgpainless.algorithm.PublicKeyAlgorithm
|
||||||
import org.pgpainless.key.generation.type.KeyType
|
import org.pgpainless.key.generation.type.KeyType
|
||||||
|
|
||||||
/**
|
/** Legacy ECDH with Curve25519. For use with OpenPGP v4 only. */
|
||||||
* Legacy ECDH with Curve25519.
|
|
||||||
* For use with OpenPGP v4 only.
|
|
||||||
*/
|
|
||||||
class XDH private constructor(spec: XDHSpec) : KeyType {
|
class XDH private constructor(spec: XDHSpec) : KeyType {
|
||||||
override val name = "XDH"
|
override val name = "XDH"
|
||||||
override val algorithm = PublicKeyAlgorithm.ECDH
|
override val algorithm = PublicKeyAlgorithm.ECDH
|
||||||
|
|
Loading…
Reference in a new issue