starcrypto/asy.go

35 lines
918 B
Go
Raw Permalink Normal View History

2024-03-10 13:31:10 +08:00
package starcrypto
2024-03-10 15:41:55 +08:00
import (
"b612.me/starcrypto/asymm"
2024-03-10 15:41:55 +08:00
"crypto"
)
func EncodePrivateKey(private crypto.PrivateKey, secret string) ([]byte, error) {
return asymm.EncodePrivateKey(private, secret)
2024-03-10 15:41:55 +08:00
}
func EncodePublicKey(public crypto.PublicKey) ([]byte, error) {
return asymm.EncodePublicKey(public)
2024-03-10 15:41:55 +08:00
}
func DecodePrivateKey(private []byte, password string) (crypto.PrivateKey, error) {
return asymm.DecodePrivateKey(private, password)
2024-03-10 15:41:55 +08:00
}
2024-08-30 14:18:46 +08:00
func EncodeOpenSSHPrivateKey(private crypto.PrivateKey, secret string) ([]byte, error) {
return asymm.EncodeOpenSSHPrivateKey(private, secret)
2024-08-30 14:18:46 +08:00
}
2024-03-10 15:41:55 +08:00
func DecodePublicKey(pubStr []byte) (crypto.PublicKey, error) {
return asymm.DecodePublicKey(pubStr)
2024-03-10 15:41:55 +08:00
}
func EncodeSSHPublicKey(public crypto.PublicKey) ([]byte, error) {
return asymm.EncodeSSHPublicKey(public)
2024-03-10 15:41:55 +08:00
}
2024-03-17 17:29:46 +08:00
func DecodeSSHPublicKey(pubStr []byte) (crypto.PublicKey, error) {
return asymm.DecodeSSHPublicKey(pubStr)
2024-03-17 17:29:46 +08:00
}