U mf @sddlmZmZddlmZmZmZddlZddl Zddl m Z ddl m Z ddlmZddlmZGdd d eZGd d d eZdS) )ABCabstractmethod)AnyOptionalTypeN) Algorithm)AlgorithmKeyMismatch)DNSKEY)Flagc@seZdZUeed<eeddddZeeeddddZ eed d d Z e e ddd d Z ejdfeee dddZe ee ddddZe eeddddZeed ddZdS)GenericPublicKey algorithmNkeyreturncCsdSNselfrrrA/opt/hc_python/lib/python3.8/site-packages/dns/dnssecalgs/base.py__init__szGenericPublicKey.__init__) signaturedatarcCsdS)zVerify signed DNSSEC dataNr)rrrrrrverifyszGenericPublicKey.verifyrcCsdS)zEncode key as bytes for DNSKEYNrrrrrencode_key_bytessz!GenericPublicKey.encode_key_bytescCs|j|jkrtdSr)r rclsrrrr!_ensure_algorithm_key_combinations z2GenericPublicKey._ensure_algorithm_key_combination)flagsprotocolrcCs"ttjjtjj|||j|dS)zReturn public key as DNSKEY)ZrdclassZrdtyper r!r r)r dnsZ rdataclassINZ rdatatyper r)rr r!rrr to_dnskey szGenericPublicKey.to_dnskeycCsdS)zCreate public key from DNSKEYNrrrrr from_dnskey+szGenericPublicKey.from_dnskey) public_pemrcCsdS)zXCreate public key from PEM-encoded SubjectPublicKeyInfo as specified in RFC 5280Nr)rr&rrrfrom_pem0szGenericPublicKey.from_pemcCsdS)zVReturn public-key as PEM-encoded SubjectPublicKeyInfo as specified in RFC 5280Nrrrrrto_pem6szGenericPublicKey.to_pem)__name__ __module__ __qualname__r__annotations__rrrbytesrr classmethodr rr ZZONEintr$r%r'r(rrrrr s$  r c@seZdZUeeed<eeddddZede e e ddd Z ed d d d Z e ede ee ddddZedee e dddZdS)GenericPrivateKeyZ public_clsNr cCsdSrrrrrrr?szGenericPrivateKey.__init__F)rrrcCsdS)zSign DNSSEC dataNr)rrrrrrsignCszGenericPrivateKey.signr rcCsdS)zReturn public key instanceNrrrrr public_keyGszGenericPrivateKey.public_key) private_pempasswordrcCsdS)z*Create private key from PEM-encoded PKCS#8Nr)rr3r4rrrr'KszGenericPrivateKey.from_pem)r4rcCsdS)z(Return private key as PEM-encoded PKCS#8Nr)rr4rrrr(RszGenericPrivateKey.to_pem)F)N)N)r)r*r+rr r,rrrr-boolr1r2r.rr'r(rrrrr0<s"  r0)abcrrtypingrrrZdns.rdataclassr"Z dns.rdatatypeZdns.dnssectypesrZ dns.exceptionrZdns.rdtypes.ANY.DNSKEYr Zdns.rdtypes.dnskeybaser r r0rrrrs    0