Documentation ¶
Index ¶
- Variables
- type AESEncryptionFunction
- func (A AESEncryptionFunction) Decrypt(key *framework.SymmetricKey, ciphertext *framework.SymmetricCiphertext) ([]byte, error)
- func (A AESEncryptionFunction) Encrypt(key *framework.SymmetricKey, data []byte) (*framework.SymmetricCiphertext, error)
- func (A AESEncryptionFunction) GenerateSymmetricKey() *framework.SymmetricKey
- func (A AESEncryptionFunction) GetAlgorithm() framework.CryptoAlgorithm
- func (A AESEncryptionFunction) ParseCiphertext(ciphertextBytes []byte) (*framework.SymmetricCiphertext, error)
- func (A AESEncryptionFunction) ParseSymmetricKey(symmetricKeyBytes []byte) (*framework.SymmetricKey, error)
- func (A AESEncryptionFunction) SupportCiphertext(ciphertextBytes []byte) bool
- func (A AESEncryptionFunction) SupportSymmetricKey(symmetricKeyBytes []byte) bool
- type ClassicCryptoService
- type ECDSASignatureFunction
- func (E ECDSASignatureFunction) GenerateKeypair() (*framework.AsymmetricKeypair, error)
- func (E ECDSASignatureFunction) GenerateKeypairWithSeed(seed []byte) (keypair *framework.AsymmetricKeypair, err error)
- func (E ECDSASignatureFunction) GetAlgorithm() framework.CryptoAlgorithm
- func (E ECDSASignatureFunction) ParseDigest(digestBytes []byte) (*framework.SignatureDigest, error)
- func (E ECDSASignatureFunction) ParsePrivKey(privKeyBytes []byte) (*framework.PrivKey, error)
- func (E ECDSASignatureFunction) ParsePubKey(pubKeyBytes []byte) (*framework.PubKey, error)
- func (E ECDSASignatureFunction) RetrieveEncrypedPrivKey(privateKey string, pwd []byte) (*framework.PrivKey, error)
- func (E ECDSASignatureFunction) RetrievePrivKey(privateKey string) (*framework.PrivKey, error)
- func (E ECDSASignatureFunction) RetrievePubKey(privKey *framework.PrivKey) (*framework.PubKey, error)
- func (E ECDSASignatureFunction) RetrievePubKeyFromCA(cert *ca.Certificate) (*framework.PubKey, error)
- func (E ECDSASignatureFunction) Sign(privKey *framework.PrivKey, data []byte) (*framework.SignatureDigest, error)
- func (E ECDSASignatureFunction) SupportDigest(digestBytes []byte) bool
- func (E ECDSASignatureFunction) SupportPrivKey(privKeyBytes []byte) bool
- func (E ECDSASignatureFunction) SupportPubKey(pubKeyBytes []byte) bool
- func (E ECDSASignatureFunction) Verify(pubKey *framework.PubKey, data []byte, digest *framework.SignatureDigest) bool
- type ED25519SignatureFunction
- func (E ED25519SignatureFunction) GenerateKeypair() (*framework.AsymmetricKeypair, error)
- func (E ED25519SignatureFunction) GenerateKeypairWithSeed(seed []byte) (keypair *framework.AsymmetricKeypair, err error)
- func (E ED25519SignatureFunction) GetAlgorithm() framework.CryptoAlgorithm
- func (E ED25519SignatureFunction) ParseDigest(digestBytes []byte) (*framework.SignatureDigest, error)
- func (E ED25519SignatureFunction) ParsePrivKey(privKeyBytes []byte) (*framework.PrivKey, error)
- func (E ED25519SignatureFunction) ParsePubKey(pubKeyBytes []byte) (*framework.PubKey, error)
- func (E ED25519SignatureFunction) RetrieveEncrypedPrivKey(privateKey string, pwd []byte) (*framework.PrivKey, error)
- func (E ED25519SignatureFunction) RetrievePrivKey(privateKey string) (*framework.PrivKey, error)
- func (E ED25519SignatureFunction) RetrievePubKey(privKey *framework.PrivKey) (*framework.PubKey, error)
- func (E ED25519SignatureFunction) RetrievePubKeyFromCA(cert *ca.Certificate) (*framework.PubKey, error)
- func (E ED25519SignatureFunction) Sign(privKey *framework.PrivKey, data []byte) (*framework.SignatureDigest, error)
- func (E ED25519SignatureFunction) SupportDigest(digestBytes []byte) bool
- func (E ED25519SignatureFunction) SupportPrivKey(privKeyBytes []byte) bool
- func (E ED25519SignatureFunction) SupportPubKey(pubKeyBytes []byte) bool
- func (E ED25519SignatureFunction) Verify(pubKey *framework.PubKey, data []byte, digest *framework.SignatureDigest) bool
- type GoRandomFunction
- type GoRandomGenerator
- type RIPEMD160HashFunction
- func (R RIPEMD160HashFunction) GetAlgorithm() framework.CryptoAlgorithm
- func (R RIPEMD160HashFunction) Hash(data []byte) *framework.HashDigest
- func (R RIPEMD160HashFunction) ParseHashDigest(digestBytes []byte) (*framework.HashDigest, error)
- func (R RIPEMD160HashFunction) SupportHashDigest(digestBytes []byte) bool
- func (R RIPEMD160HashFunction) Verify(digest *framework.HashDigest, data []byte) bool
- type RSACryptoFunction
- func (R RSACryptoFunction) Decrypt(privKey *framework.PrivKey, ciphertext *framework.AsymmetricCiphertext) ([]byte, error)
- func (R RSACryptoFunction) Encrypt(pubKey *framework.PubKey, data []byte) (*framework.AsymmetricCiphertext, error)
- func (R RSACryptoFunction) GenerateKeypair() (*framework.AsymmetricKeypair, error)
- func (R RSACryptoFunction) GenerateKeypairWithSeed(seed []byte) (keypair *framework.AsymmetricKeypair, err error)
- func (R RSACryptoFunction) GetAlgorithm() framework.CryptoAlgorithm
- func (R RSACryptoFunction) ParseCiphertext(ciphertextBytes []byte) (*framework.AsymmetricCiphertext, error)
- func (R RSACryptoFunction) ParseDigest(digestBytes []byte) (*framework.SignatureDigest, error)
- func (R RSACryptoFunction) ParsePrivKey(privKeyBytes []byte) (*framework.PrivKey, error)
- func (R RSACryptoFunction) ParsePubKey(pubKeyBytes []byte) (*framework.PubKey, error)
- func (R RSACryptoFunction) RetrieveEncrypedPrivKey(privateKey string, pwd []byte) (*framework.PrivKey, error)
- func (R RSACryptoFunction) RetrievePrivKey(privateKey string) (*framework.PrivKey, error)
- func (R RSACryptoFunction) RetrievePubKey(privKey *framework.PrivKey) (*framework.PubKey, error)
- func (R RSACryptoFunction) RetrievePubKeyFromCA(cert *ca.Certificate) (*framework.PubKey, error)
- func (R RSACryptoFunction) Sign(privKey *framework.PrivKey, data []byte) (*framework.SignatureDigest, error)
- func (R RSACryptoFunction) SupportCiphertext(ciphertextBytes []byte) bool
- func (R RSACryptoFunction) SupportDigest(digestBytes []byte) bool
- func (R RSACryptoFunction) SupportPrivKey(privKeyBytes []byte) bool
- func (R RSACryptoFunction) SupportPubKey(pubKeyBytes []byte) bool
- func (R RSACryptoFunction) Verify(pubKey *framework.PubKey, data []byte, digest *framework.SignatureDigest) bool
- type SHA256HashFunction
- func (S SHA256HashFunction) GetAlgorithm() framework.CryptoAlgorithm
- func (S SHA256HashFunction) Hash(data []byte) *framework.HashDigest
- func (S SHA256HashFunction) ParseHashDigest(digestBytes []byte) (*framework.HashDigest, error)
- func (S SHA256HashFunction) SupportHashDigest(digestBytes []byte) bool
- func (S SHA256HashFunction) Verify(digest *framework.HashDigest, data []byte) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AES_KEY_SIZE = 128 / 8 AES_BLOCK_SIZE = 128 / 8 // AES-ECB AES_PLAINTEXT_BUFFER_LENGTH = 256 AES_CIPHERTEXT_BUFFER_LENGTH = 256 + 16 + 2 AES_SYMMETRICKEY_LENGTH = framework.ALGORYTHM_CODE_SIZE + framework.KEY_TYPE_BYTES + AES_KEY_SIZE )
View Source
var ( ED25519_ALGORITHM = framework.DefineSignature("ED25519", false, 21) ECDSA_ALGORITHM = framework.DefineSignature("ECDSA", false, 22) RSA_ALGORITHM = framework.DefineSignature("RSA", true, 23) SHA256_ALGORITHM = framework.DefineHash("SHA256", 24) RIPEMD160_ALGORITHM = framework.DefineHash("RIPEMD160", 25) AES_ALGORITHM = framework.DefineSymmetricEncryption("AES", 26) GO_RANDOM_ALGORITHM = framework.DefineRandom("GO-RANDOM", 27) )
View Source
var ( AES = AESEncryptionFunction{} ED25519 = ED25519SignatureFunction{} RIPEMD160 = RIPEMD160HashFunction{} SHA256 = SHA256HashFunction{} GO_RANDOM = GoRandomFunction{} ECDSA = ECDSASignatureFunction{} RSA = RSACryptoFunction{} )
View Source
var ( ECDSA_PUBKEY_SIZE = 65 ECDSA_PRIVKEY_SIZE = 32 ECDSA_SIGNATUREDIGEST_SIZE = 64 ECDSA_PUBKEY_LENGTH = framework.ALGORYTHM_CODE_SIZE + framework.KEY_TYPE_BYTES + ECDSA_PUBKEY_SIZE ECDSA_PRIVKEY_LENGTH = framework.ALGORYTHM_CODE_SIZE + framework.KEY_TYPE_BYTES + ECDSA_PRIVKEY_SIZE ECDSA_SIGNATUREDIGEST_LENGTH = framework.ALGORYTHM_CODE_SIZE + ECDSA_SIGNATUREDIGEST_SIZE )
View Source
var ( ED25519_PUBKEY_SIZE = 32 ED25519_PRIVKEY_SIZE = 32 ED25519_SIGNATUREDIGEST_SIZE = 64 ED25519_PUBKEY_LENGTH = framework.ALGORYTHM_CODE_SIZE + framework.KEY_TYPE_BYTES + ED25519_PUBKEY_SIZE ED25519_PRIVKEY_LENGTH = framework.ALGORYTHM_CODE_SIZE + framework.KEY_TYPE_BYTES + ED25519_PRIVKEY_SIZE ED25519_SIGNATUREDIGEST_LENGTH = framework.ALGORYTHM_CODE_SIZE + ED25519_SIGNATUREDIGEST_SIZE )
View Source
var ( RIPEMD160_DIGEST_BYTES = 160 / 8 RIPEMD160_DIGEST_LENGTH = framework.ALGORYTHM_CODE_SIZE + RIPEMD160_DIGEST_BYTES )
View Source
var ( // modulus.length = 256, publicExponent.length = 3 RSA_PUBKEY_SIZE = 259 // modulus.length = 256, publicExponent.length = 3, privateExponent.length = 256, p.length = 128, q.length =128, // dP.length = 128, dQ.length = 128, qInv.length = 128 RSA_PRIVKEY_SIZE = 1155 RSA_SIGNATUREDIGEST_SIZE = 256 RSA_CIPHERTEXTBLOCK_SIZE = 256 RSA_PUBKEY_LENGTH = framework.ALGORYTHM_CODE_SIZE + framework.KEY_TYPE_BYTES + RSA_PUBKEY_SIZE RSA_PRIVKEY_LENGTH = framework.ALGORYTHM_CODE_SIZE + framework.KEY_TYPE_BYTES + RSA_PRIVKEY_SIZE RSA_SIGNATUREDIGEST_LENGTH = framework.ALGORYTHM_CODE_SIZE + RSA_SIGNATUREDIGEST_SIZE )
View Source
var SHA256_DIGEST_BYTES = 256 / 8
Functions ¶
This section is empty.
Types ¶
type AESEncryptionFunction ¶
type AESEncryptionFunction struct { }
func (AESEncryptionFunction) Decrypt ¶
func (A AESEncryptionFunction) Decrypt(key *framework.SymmetricKey, ciphertext *framework.SymmetricCiphertext) ([]byte, error)
func (AESEncryptionFunction) Encrypt ¶
func (A AESEncryptionFunction) Encrypt(key *framework.SymmetricKey, data []byte) (*framework.SymmetricCiphertext, error)
func (AESEncryptionFunction) GenerateSymmetricKey ¶
func (A AESEncryptionFunction) GenerateSymmetricKey() *framework.SymmetricKey
func (AESEncryptionFunction) GetAlgorithm ¶
func (A AESEncryptionFunction) GetAlgorithm() framework.CryptoAlgorithm
func (AESEncryptionFunction) ParseCiphertext ¶
func (A AESEncryptionFunction) ParseCiphertext(ciphertextBytes []byte) (*framework.SymmetricCiphertext, error)
func (AESEncryptionFunction) ParseSymmetricKey ¶
func (A AESEncryptionFunction) ParseSymmetricKey(symmetricKeyBytes []byte) (*framework.SymmetricKey, error)
func (AESEncryptionFunction) SupportCiphertext ¶
func (A AESEncryptionFunction) SupportCiphertext(ciphertextBytes []byte) bool
func (AESEncryptionFunction) SupportSymmetricKey ¶
func (A AESEncryptionFunction) SupportSymmetricKey(symmetricKeyBytes []byte) bool
type ClassicCryptoService ¶
type ClassicCryptoService struct {
// contains filtered or unexported fields
}
func NewClassicCryptoService ¶
func NewClassicCryptoService() ClassicCryptoService
func (ClassicCryptoService) GetFunctions ¶
func (c ClassicCryptoService) GetFunctions() []framework.CryptoFunction
type ECDSASignatureFunction ¶
type ECDSASignatureFunction struct { }
func (ECDSASignatureFunction) GenerateKeypair ¶
func (E ECDSASignatureFunction) GenerateKeypair() (*framework.AsymmetricKeypair, error)
func (ECDSASignatureFunction) GenerateKeypairWithSeed ¶
func (E ECDSASignatureFunction) GenerateKeypairWithSeed(seed []byte) (keypair *framework.AsymmetricKeypair, err error)
func (ECDSASignatureFunction) GetAlgorithm ¶
func (E ECDSASignatureFunction) GetAlgorithm() framework.CryptoAlgorithm
func (ECDSASignatureFunction) ParseDigest ¶
func (E ECDSASignatureFunction) ParseDigest(digestBytes []byte) (*framework.SignatureDigest, error)
func (ECDSASignatureFunction) ParsePrivKey ¶
func (E ECDSASignatureFunction) ParsePrivKey(privKeyBytes []byte) (*framework.PrivKey, error)
func (ECDSASignatureFunction) ParsePubKey ¶
func (E ECDSASignatureFunction) ParsePubKey(pubKeyBytes []byte) (*framework.PubKey, error)
func (ECDSASignatureFunction) RetrieveEncrypedPrivKey ¶ added in v1.3.0
func (ECDSASignatureFunction) RetrievePrivKey ¶ added in v1.3.0
func (E ECDSASignatureFunction) RetrievePrivKey(privateKey string) (*framework.PrivKey, error)
func (ECDSASignatureFunction) RetrievePubKey ¶
func (ECDSASignatureFunction) RetrievePubKeyFromCA ¶ added in v1.3.0
func (E ECDSASignatureFunction) RetrievePubKeyFromCA(cert *ca.Certificate) (*framework.PubKey, error)
func (ECDSASignatureFunction) Sign ¶
func (E ECDSASignatureFunction) Sign(privKey *framework.PrivKey, data []byte) (*framework.SignatureDigest, error)
func (ECDSASignatureFunction) SupportDigest ¶
func (E ECDSASignatureFunction) SupportDigest(digestBytes []byte) bool
func (ECDSASignatureFunction) SupportPrivKey ¶
func (E ECDSASignatureFunction) SupportPrivKey(privKeyBytes []byte) bool
func (ECDSASignatureFunction) SupportPubKey ¶
func (E ECDSASignatureFunction) SupportPubKey(pubKeyBytes []byte) bool
func (ECDSASignatureFunction) Verify ¶
func (E ECDSASignatureFunction) Verify(pubKey *framework.PubKey, data []byte, digest *framework.SignatureDigest) bool
type ED25519SignatureFunction ¶
type ED25519SignatureFunction struct { }
func (ED25519SignatureFunction) GenerateKeypair ¶
func (E ED25519SignatureFunction) GenerateKeypair() (*framework.AsymmetricKeypair, error)
func (ED25519SignatureFunction) GenerateKeypairWithSeed ¶
func (E ED25519SignatureFunction) GenerateKeypairWithSeed(seed []byte) (keypair *framework.AsymmetricKeypair, err error)
func (ED25519SignatureFunction) GetAlgorithm ¶
func (E ED25519SignatureFunction) GetAlgorithm() framework.CryptoAlgorithm
func (ED25519SignatureFunction) ParseDigest ¶
func (E ED25519SignatureFunction) ParseDigest(digestBytes []byte) (*framework.SignatureDigest, error)
func (ED25519SignatureFunction) ParsePrivKey ¶
func (E ED25519SignatureFunction) ParsePrivKey(privKeyBytes []byte) (*framework.PrivKey, error)
func (ED25519SignatureFunction) ParsePubKey ¶
func (E ED25519SignatureFunction) ParsePubKey(pubKeyBytes []byte) (*framework.PubKey, error)
func (ED25519SignatureFunction) RetrieveEncrypedPrivKey ¶ added in v1.3.0
func (ED25519SignatureFunction) RetrievePrivKey ¶ added in v1.3.0
func (E ED25519SignatureFunction) RetrievePrivKey(privateKey string) (*framework.PrivKey, error)
func (ED25519SignatureFunction) RetrievePubKey ¶
func (ED25519SignatureFunction) RetrievePubKeyFromCA ¶ added in v1.3.0
func (E ED25519SignatureFunction) RetrievePubKeyFromCA(cert *ca.Certificate) (*framework.PubKey, error)
func (ED25519SignatureFunction) Sign ¶
func (E ED25519SignatureFunction) Sign(privKey *framework.PrivKey, data []byte) (*framework.SignatureDigest, error)
func (ED25519SignatureFunction) SupportDigest ¶
func (E ED25519SignatureFunction) SupportDigest(digestBytes []byte) bool
func (ED25519SignatureFunction) SupportPrivKey ¶
func (E ED25519SignatureFunction) SupportPrivKey(privKeyBytes []byte) bool
func (ED25519SignatureFunction) SupportPubKey ¶
func (E ED25519SignatureFunction) SupportPubKey(pubKeyBytes []byte) bool
func (ED25519SignatureFunction) Verify ¶
func (E ED25519SignatureFunction) Verify(pubKey *framework.PubKey, data []byte, digest *framework.SignatureDigest) bool
type GoRandomFunction ¶
type GoRandomFunction struct { }
func (GoRandomFunction) Generate ¶
func (g GoRandomFunction) Generate(seed int64) framework.RandomGenerator
func (GoRandomFunction) GetAlgorithm ¶
func (g GoRandomFunction) GetAlgorithm() framework.CryptoAlgorithm
type GoRandomGenerator ¶
type GoRandomGenerator struct {
// contains filtered or unexported fields
}
func (GoRandomGenerator) NextBytes ¶
func (g GoRandomGenerator) NextBytes(size int) []byte
type RIPEMD160HashFunction ¶
type RIPEMD160HashFunction struct { }
func (RIPEMD160HashFunction) GetAlgorithm ¶
func (R RIPEMD160HashFunction) GetAlgorithm() framework.CryptoAlgorithm
func (RIPEMD160HashFunction) Hash ¶
func (R RIPEMD160HashFunction) Hash(data []byte) *framework.HashDigest
func (RIPEMD160HashFunction) ParseHashDigest ¶
func (R RIPEMD160HashFunction) ParseHashDigest(digestBytes []byte) (*framework.HashDigest, error)
func (RIPEMD160HashFunction) SupportHashDigest ¶
func (R RIPEMD160HashFunction) SupportHashDigest(digestBytes []byte) bool
func (RIPEMD160HashFunction) Verify ¶
func (R RIPEMD160HashFunction) Verify(digest *framework.HashDigest, data []byte) bool
type RSACryptoFunction ¶
type RSACryptoFunction struct { }
func (RSACryptoFunction) Decrypt ¶
func (R RSACryptoFunction) Decrypt(privKey *framework.PrivKey, ciphertext *framework.AsymmetricCiphertext) ([]byte, error)
func (RSACryptoFunction) Encrypt ¶
func (R RSACryptoFunction) Encrypt(pubKey *framework.PubKey, data []byte) (*framework.AsymmetricCiphertext, error)
func (RSACryptoFunction) GenerateKeypair ¶
func (R RSACryptoFunction) GenerateKeypair() (*framework.AsymmetricKeypair, error)
func (RSACryptoFunction) GenerateKeypairWithSeed ¶
func (R RSACryptoFunction) GenerateKeypairWithSeed(seed []byte) (keypair *framework.AsymmetricKeypair, err error)
func (RSACryptoFunction) GetAlgorithm ¶
func (R RSACryptoFunction) GetAlgorithm() framework.CryptoAlgorithm
func (RSACryptoFunction) ParseCiphertext ¶
func (R RSACryptoFunction) ParseCiphertext(ciphertextBytes []byte) (*framework.AsymmetricCiphertext, error)
func (RSACryptoFunction) ParseDigest ¶
func (R RSACryptoFunction) ParseDigest(digestBytes []byte) (*framework.SignatureDigest, error)
func (RSACryptoFunction) ParsePrivKey ¶
func (R RSACryptoFunction) ParsePrivKey(privKeyBytes []byte) (*framework.PrivKey, error)
func (RSACryptoFunction) ParsePubKey ¶
func (R RSACryptoFunction) ParsePubKey(pubKeyBytes []byte) (*framework.PubKey, error)
func (RSACryptoFunction) RetrieveEncrypedPrivKey ¶ added in v1.3.0
func (RSACryptoFunction) RetrievePrivKey ¶ added in v1.3.0
func (R RSACryptoFunction) RetrievePrivKey(privateKey string) (*framework.PrivKey, error)
func (RSACryptoFunction) RetrievePubKey ¶
func (RSACryptoFunction) RetrievePubKeyFromCA ¶ added in v1.3.0
func (R RSACryptoFunction) RetrievePubKeyFromCA(cert *ca.Certificate) (*framework.PubKey, error)
func (RSACryptoFunction) Sign ¶
func (R RSACryptoFunction) Sign(privKey *framework.PrivKey, data []byte) (*framework.SignatureDigest, error)
func (RSACryptoFunction) SupportCiphertext ¶
func (R RSACryptoFunction) SupportCiphertext(ciphertextBytes []byte) bool
func (RSACryptoFunction) SupportDigest ¶
func (R RSACryptoFunction) SupportDigest(digestBytes []byte) bool
func (RSACryptoFunction) SupportPrivKey ¶
func (R RSACryptoFunction) SupportPrivKey(privKeyBytes []byte) bool
func (RSACryptoFunction) SupportPubKey ¶
func (R RSACryptoFunction) SupportPubKey(pubKeyBytes []byte) bool
func (RSACryptoFunction) Verify ¶
func (R RSACryptoFunction) Verify(pubKey *framework.PubKey, data []byte, digest *framework.SignatureDigest) bool
type SHA256HashFunction ¶
type SHA256HashFunction struct { }
func (SHA256HashFunction) GetAlgorithm ¶
func (S SHA256HashFunction) GetAlgorithm() framework.CryptoAlgorithm
func (SHA256HashFunction) Hash ¶
func (S SHA256HashFunction) Hash(data []byte) *framework.HashDigest
func (SHA256HashFunction) ParseHashDigest ¶
func (S SHA256HashFunction) ParseHashDigest(digestBytes []byte) (*framework.HashDigest, error)
func (SHA256HashFunction) SupportHashDigest ¶
func (S SHA256HashFunction) SupportHashDigest(digestBytes []byte) bool
func (SHA256HashFunction) Verify ¶
func (S SHA256HashFunction) Verify(digest *framework.HashDigest, data []byte) bool
Click to show internal directories.
Click to hide internal directories.