@@ -685,67 +685,6 @@ func TestKeyWithSubKeyAndBadSelfSigOrder(t *testing.T) {
685685
686686}
687687
688- /*func TestKeyUsage(t *testing.T) {
689- kring, err := ReadKeyRing(readerFromHex(subkeyUsageHex))
690- if err != nil {
691- t.Fatal(err)
692- }
693-
694- // subkeyUsageHex contains these keys:
695- // pub 1024R/2866382A created: 2014-04-01 expires: never usage: SC
696- // sub 1024R/936C9153 created: 2014-04-01 expires: never usage: E
697- // sub 1024R/64D5F5BB created: 2014-04-02 expires: never usage: E
698- // sub 1024D/BC0BA992 created: 2014-04-02 expires: never usage: S
699- certifiers := []uint64{0xA42704B92866382A}
700- signers := []uint64{0xA42704B92866382A, 0x42CE2C64BC0BA992}
701- encrypters := []uint64{0x09C0C7D9936C9153, 0xC104E98664D5F5BB}
702-
703- for _, id := range certifiers {
704- keys := kring.KeysByIdUsage(id, packet.KeyFlagCertify)
705- if len(keys) == 1 {
706- if keys[0].PublicKey.KeyId != id {
707- t.Errorf("Expected to find certifier key id %X, but got %X", id, keys[0].PublicKey.KeyId)
708- }
709- } else {
710- t.Errorf("Expected one match for certifier key id %X, but got %d matches", id, len(keys))
711- }
712- }
713-
714- for _, id := range signers {
715- keys := kring.KeysByIdUsage(id, packet.KeyFlagSign)
716- if len(keys) == 1 {
717- if keys[0].PublicKey.KeyId != id {
718- t.Errorf("Expected to find signing key id %X, but got %X", id, keys[0].PublicKey.KeyId)
719- }
720- } else {
721- t.Errorf("Expected one match for signing key id %X, but got %d matches", id, len(keys))
722- }
723-
724- // This keyring contains no encryption keys that are also good for signing.
725- keys = kring.KeysByIdUsage(id, packet.KeyFlagEncryptStorage|packet.KeyFlagEncryptCommunications)
726- if len(keys) != 0 {
727- t.Errorf("Unexpected match for encryption key id %X", id)
728- }
729- }
730-
731- for _, id := range encrypters {
732- keys := kring.KeysByIdUsage(id, packet.KeyFlagEncryptStorage|packet.KeyFlagEncryptCommunications)
733- if len(keys) == 1 {
734- if keys[0].PublicKey.KeyId != id {
735- t.Errorf("Expected to find encryption key id %X, but got %X", id, keys[0].PublicKey.KeyId)
736- }
737- } else {
738- t.Errorf("Expected one match for encryption key id %X, but got %d matches", id, len(keys))
739- }
740-
741- // This keyring contains no encryption keys that are also good for signing.
742- keys = kring.KeysByIdUsage(id, packet.KeyFlagSign)
743- if len(keys) != 0 {
744- t.Errorf("Unexpected match for signing key id %X", id)
745- }
746- }
747- }*/
748-
749688func TestIdVerification (t * testing.T ) {
750689 kring , err := ReadKeyRing (readerFromHex (testKeys1And2PrivateHex ))
751690 if err != nil {
@@ -1464,25 +1403,6 @@ func TestRevokeSubkey(t *testing.T) {
14641403 }
14651404}
14661405
1467- /*func TestRevokeSubkeyWithAnotherEntity(t *testing.T) {
1468- entity, err := NewEntity("Golang Gopher", "Test Key", "[email protected] ", nil) 1469- if err != nil {
1470- t.Fatal(err)
1471- }
1472-
1473- sk := entity.Subkeys[0]
1474-
1475- newEntity, err := NewEntity("Golang Gopher", "Test Key", "[email protected] ", nil) 1476- if err != nil {
1477- t.Fatal(err)
1478- }
1479-
1480- err = newEntity.RevokeSubkey(&sk, packet.NoReason, "Key revocation", nil)
1481- if err == nil {
1482- t.Fatal("Entity was able to revoke a subkey owned by a different entity")
1483- }
1484- }*/
1485-
14861406func TestRevokeSubkeyWithInvalidSignature (t * testing.T ) {
14871407 entity ,
err := NewEntity (
"Golang Gopher" ,
"Test Key" ,
"[email protected] " ,
nil )
14881408 if err != nil {
0 commit comments